-
Notifications
You must be signed in to change notification settings - Fork 683
[Feature] Support program upgrades. #28593
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
Conversation
36e36e9
to
75d8b19
Compare
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.
tests/expectations/execution/program_core_functions.out
is empty.
BTW I realized the line
Err(e) => e.to_string(),
in test_execution.rs
should have a buf.extract_errs()
; might help you see the actual error happening here.
One thing that's not clear to me is how we expect this to roll out. Are we going to allow programs with no constructors or not? Are we going to merge this, and just have the mainnet
branch of Leo depend on an unreleased Snarkvm commit for now?
.expect("Type checking guarantees that the program name is valid"); | ||
// If the program name matches the current program ID, then use `checksum`, otherwise fully qualify the operand. | ||
let operand = match program_id.to_string() | ||
== self.program_id.expect("The program ID is set before traversing the program").to_string() |
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: you could just remove both of the to_string()
s
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.
This is necessary because equality for ProgramId
includes the span.
tests/tests/compiler/constructor/calls_in_constructors_fail.leo
Outdated
Show resolved
Hide resolved
function foo(a: bool) { | ||
assert_eq(true, a); | ||
} | ||
|
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: whitespace
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.
Could you clarify?
The implementation supports programs without constructors. You bring up a good question on merging into |
input r0 as field; | ||
assert.eq true true; | ||
output r0 as field; | ||
Error [ECMP0376012]: Unable to resolve call to generic function `def`. A non-const expression `C` was provided where a const generic parameter is required. |
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 output of this test changed.. The reason for that is the change you made in monomorphization/program.rs
that does a post order traversal of the call graph without considering entry points. The reason why we need to consider entry points is to ignore const generic inline
s that have been monomorphized already but are still there without users. Otherwise, we will emit an error saying that such functions cannot be monomorphized which is incorrect. I should have made that clearer in a comment.
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.
Thanks for pointing that out!
Should be resolved.
This PR supports program upgradability in Leo.
To that end we:
leo upgrade
which is used to deploy the upgrade to the network.Network
trait from the compiler.and also closes:
const_propagation_and_unrolling.rs
#28678See this issue to track
snarkVM
support.See the examples for more information.
To Reviewers. This PR has ballooned since it's inception. Let me know if you'd like me to break it up into pieces.