Skip to content
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

RFC: Specification for the version management #19

Merged
merged 22 commits into from
Sep 20, 2019

Conversation

hansl
Copy link
Contributor

@hansl hansl commented Aug 30, 2019

Requesting comments on this proposal. This is coming from a week of brainstorming and whiteboarding with Paul, Diego and myself.

Essentially this would allow us to manage versions independently from project to project, create a project with always the latest version, allow users to start new projects without an internet connection, let user upgrade at their own pace (even if it means their test net is versions behind the main net), and let us run integration tests on any version necessary (even custom SHAs). This cover all use cases I could think of, so if you think of something else let me know so I can integrate it.

This does not require a significant amount of code from our part. As a matter of fact the mocked CLI implement some of this proposal already (bundling and checking versions).

The complex part will be the migration scripts, but I would like to defer that work to after the 1.0 release.

@hansl hansl requested review from paulyoung, dprats and a user August 30, 2019 00:57
@hansl hansl force-pushed the hansl/version-management-spec branch 2 times, most recently from 8187008 to f68419d Compare August 30, 2019 00:57
@hansl hansl force-pushed the hansl/version-management-spec branch from f68419d to b1bc9ff Compare August 30, 2019 01:00
@nomeata
Copy link
Contributor

nomeata commented Aug 30, 2019

Not sure if we are at the right time to discuss this, but secure software upgrade is like crypto: Dangerous if you just roll your own solution. Just too many corner cases to worry about.

Do you know about https://theupdateframework.github.io/?

@hansl
Copy link
Contributor Author

hansl commented Aug 30, 2019

Thanks for the feedback @nomeata. I might not have made it clear here, but no binary is actually updated. The global dfx is essentially a version manager in this case; being able to switch and download different versions. In that sense, it’s closer to (e.g.) rustup. Does that make it clearer? I don’t think we can use the link you posted considering this.

I’ll try to update my document to clarify this stance.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

A few questions:

  • Why would developers want more than one version of dfx installed?
  • What happens when there are breaking changes in the DFINITY client? How does dfx know about them?
  • What is a user still allowed to do locally on a deprecated/unsupported version of dfx versus what (e.g. deploy) do we prevent them from doing and how?

These all orbit the general problem of the DFINITY client constantly changing and individual nodes potentially running different versions of it.

@ghost
Copy link

ghost commented Aug 30, 2019

Why would developers want more than one version of dfx installed?

To be clear, I can think of a couple possibilities. I'm just wondering how common this will actually be vs having a single version of dfx that supports all currently stable versions of the DFINITY client.

@nomeata
Copy link
Contributor

nomeata commented Sep 2, 2019

An upgrade command can be made available to ping our servers, download the latest release,
install it in the user-level cache, and update the project's dfx_version field (if in a project)
to the new version.

Unless I am completely mistaken. This sounds very much like what you propose has strong overlaps with the problem space that that TUF is solving: Querying some repository for available versions, and downloading them. This makes it a package manager (even if there is only one package, “the SDK” initially), and if we consider this infrastructure security critical (e.g. are worried about people getting security upgrades this way, and are worried about attackers trying to lure them to use a “wrong” repository, or trick them into not seeing an upgrade), then the problems that the TUF researchers have identified and solved apply.

(Maybe this particular PR is the wrong place to discuss how to implement the design securely, and all I want to achieve right now is to get this project onto the radar, so that we don’t needlessly reinvent the wheel (or worse, ignore certain treats, such as an attacker presenting a properly signed but stale version of the repository to the user).

docs/specification/version-management.adoc Outdated Show resolved Hide resolved
. If there is a local DFINITY configuration file, it will use the version of the SDK specified in
it (the `dfx_version` field). If that version is not available in the cache, it will try to
download it from the Internet. If there is no connection, report the error and do not continue.
. If there is an internet connection, to a maximum of once a week, the `dfx` will reach out to
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we let our clients decide when they want to upgrade? That is, provide dfx upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This only happens when the version isn't specified by the user, e.g. when in a project (the configuration file has the version).


. The CLI will always create a new project using the latest available client and SDK.
. The CLI will still work without an internet connection.
. The global CLI never needs to be re-installed or updated. You download it once and it should
Copy link
Contributor

@knl knl Sep 2, 2019

Choose a reason for hiding this comment

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

This might be a dangerous assumption, as we might need to change something in order to get things right. That is, "never needs to be updated" might fly, however, it would be prudent to want the ability for this global CLI to be "re-installed".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll loosen up the wording a bit. This is a case where "hopefully we won't need to".

Hans and others added 2 commits September 3, 2019 09:46
Co-Authored-By: Nikola Knežević <knl@users.noreply.github.com>
@hansl
Copy link
Contributor Author

hansl commented Sep 3, 2019

@nomeata

Maybe this particular PR is the wrong place to discuss how to implement the design securely

I agree, unless those security concerns clash with this high-level proposal, I feel they are an implementation detail. This proposal is mainly to solve the version management issue from a high level design.

@hansl
Copy link
Contributor Author

hansl commented Sep 3, 2019

@stanleygjones

Why would developers want more than one version of dfx installed?

I think the most relevant case is that they aren't ready to test against the latest. One other case would be if projects/devs share a common test net that is still running on an older version.

For the DFINITY client this is most definitely not an issue; we have to provide backward compatibility for probably ever (or close to). For the SDK itself though it might mean a lot of little things like command/flag changes and the developer isn't ready to upgrade its CI/CD.

What happens when there are breaking changes in the DFINITY client? How does dfx know about them?

I think if there's a breaking change in the client we have bigger problems, but this basically ensure that a version of DFINITY you are using for a project will always have the same API. When you're ready to upgrade, run dfx upgrade and we can either try to migrate the user's code, or tell the user what to do in the cases we can't.

What is a user still allowed to do locally on a deprecated/unsupported version of dfx versus what (e.g. deploy) do we prevent them from doing and how?

Anything that affects a remote client (even if it's not mainnet) should query the version and make sure it's compatible somehow (this is handwaving as I don't know how this should be validated). I'll update the document for this special test.

@paulyoung
Copy link
Contributor

I would like to give this the attention it deserves which means I probably won't take a proper look until tomorrow.

@hansl
Copy link
Contributor Author

hansl commented Sep 3, 2019

@paulyoung There's no rush. Most of the points here we discussed offline so it should feel familiar.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

My concerns have been satisfied. Thanks.

Copy link
Contributor

@paulyoung paulyoung left a comment

Choose a reason for hiding this comment

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

Thanks for putting so much thought into this.

I left some comments and suggestions. I think some are more important than others.

docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
docs/specification/version-management.adoc Outdated Show resolved Hide resolved
Hans and others added 7 commits September 4, 2019 14:03
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Hans and others added 9 commits September 4, 2019 14:55
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
@hansl
Copy link
Contributor Author

hansl commented Sep 9, 2019

@paulyoung Please take another look when you have time.

Copy link
Contributor

@paulyoung paulyoung left a comment

Choose a reason for hiding this comment

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

I made a couple of suggestions that I think are worth considering.

https://github.com/dfinity-lab/sdk/pull/30/files#diff-759bf5c10560dc8fe61d6924fbc361ccR9 uses "global binary cache" instead of "user-level cache". Should we do the same in this document?

@hansl
Copy link
Contributor Author

hansl commented Sep 12, 2019

It's in the home folder, so it won't be global. We could discuss whether it's worth having a global cache (and where that would be; /usr/share/dfinity, and what permissions to give?), if you want to discuss the idea. My opinion is that it's simpler to do it at the user level (home folder) and give 700 permissions, so I would rather change the code/comments to be technically correct.

Hans and others added 2 commits September 13, 2019 09:47
Co-Authored-By: Paul Young <paul.young@dfinity.org>
Co-Authored-By: Paul Young <paul.young@dfinity.org>
@hansl hansl merged commit e9c6eab into master Sep 20, 2019
@hansl hansl deleted the hansl/version-management-spec branch September 20, 2019 18:10
@hansl hansl restored the hansl/version-management-spec branch September 20, 2019 18:10
@hansl hansl deleted the hansl/version-management-spec branch September 20, 2019 18:10
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.

4 participants