-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Publish one package at a time #185
Conversation
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.
The implementation is really neat, thanks!
The question for me is more about the UX of deploying interdependent smart contracts in a world where the sequencing of publishing operations is not up to the user. With this PR, semantic publication constraints of interdependent modules needs to be pushed "down" to the semantics of several transactions, as we know how to specify that a transaction has others as pre-requisites.
That's fine, and makes sense, but I'm wondering if we could have a look at user-facing error messages triggered upon simultaneous publication of several modules, and try to have them drive the user towards the right approach.
.await?; | ||
assert!(result | ||
.signed_effects | ||
.as_ref() | ||
.unwrap() | ||
.effects | ||
.status | ||
.is_ok()); | ||
Ok(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.
Nit: in tests, panics are actually a tad more useful than Results
because of their stack traces. YMMV
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.
Let me roll back this change and address it separately. I accidentally changed the semantics of this function. (it's supposed to return Result so caller can check when it's expected to fail)
Totally agreed that we need to be as helpful as possible here. The Move CLI has some features that I think we can steal/mimic/enhance in the FastX client:
This becomes a problem if user A publishes a package and then user B immediately publishes one that depends on it before all authorities (or to be precise, the ones B is talking to) learn about A's package. But hopefully this interval will be very short. I'm hoping transactions within this interval won't very common in practice (i.e., the more typical flow will be that A publishes, announces their launch everywhere, B sees it and decides to build on it, then publishes days/weeks/months later), but definitely a case that we should handle gracefully regardless. |
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.
Fantastic simplifications!
This is actually easy to avoid. One check I probably should add, is that during publishing, all dependencies must not have the same address as the ones being published. As long as we can enforce this, we don't need to worry about the timing, because one needs to successfully publish a package, obtain the address, update the Move.toml before it can even become a dependency. |
In the existing implementation, when publishing a list of modules, we group all the modules by their address, and generate one package per address. This means one can publish multiple packages at a time. This has several disadvantages:
This PR changes it to publish one package at a time. I also had some interesting realizations that allow me to further simply the implementation.
A summary of this PR:
generate_package_info_map
togenerate_package_id
, since we no longer generate multiple packages.examples
directory is moved out of framework to avoid being published together into genesis.