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
[types] Deprecate Transaction::Program #923
Conversation
38e51f0
to
ee6c603
Compare
☔ The latest upstream changes (presumably 7f2ca75) made this pull request unmergeable. Please resolve the merge conflicts. |
This diff is going to use our new model of Transaction::Script and Transaction::Module to do simple payment transactions in the libra codebase. This diff will NOT be a breaking change though as we still keep the functionality of processing Transaction::Program in the VM so that we will have some time to break the backward incompatability there.
ee6c603
to
f20bdaf
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.
this looks great to me. As mentioned in a comment I wonder if we should also rename a bunch of variables from program to script though not critical.
Also we need to fix the linter so waiting for a working update to accept.
Review of the canonical serializer would be good @davidiw though it looks fine to me
@@ -89,18 +89,12 @@ impl<'a> Compiler<'a> { | |||
} | |||
|
|||
/// Compiles the code and arguments into a `Program` -- the bytecode is serialized. | |||
pub fn into_program(mut self, args: Vec<TransactionArgument>) -> Result<Program> { | |||
pub fn into_program(mut self, args: Vec<TransactionArgument>) -> Result<Script> { |
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.
should we call this into_script? and fix the comment as well?
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 reason why I didn't rename it to into_script is because we've already have input_script
in the scope.
), | ||
}, | ||
_ => panic!("Signed transaction payload arguments must have two arguments."), | ||
}, | ||
_ => panic!("Signed transaction payload expected to be of struct Program"), |
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.
change Program to Script?
// Test helper for transaction creation | ||
pub fn get_test_signed_transaction( | ||
sender: AccountAddress, | ||
sequence_number: u64, | ||
private_key: Ed25519PrivateKey, | ||
public_key: Ed25519PublicKey, | ||
program: Option<Program>, | ||
program: Option<Script>, |
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.
should we also change all those variables from program to script?
This PR made the following dependency changes: Removed Packages (Remaining versions in '()'):
getopts 0.2.21
repl 0.1.0
|
CLI part lgtm! I see that syntax has changed a bit. Should we update our online documentation? cc: @archjayas |
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.
LGTM, let's follow up on the online doc change if any
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.
lgtm for canonical
It might be worth updating this file to: https://github.com/libra/libra/blob/master/common/canonical_serialization/README.md |
Motivation
This diff is going to use our new model of Transaction::Script and Transaction::Module to do simple payment transactions in the libra codebase. Previously the normal transaction has one type of payload: Transaction::Program and one can publish a module AND execute some script within one single transaction. This feature however, is complicating the VM a lot and can really buy us few things as the modules are stateless. In our new model, we will have two types of transactions: Transaction::Module which one can use to publish a module and do nothing else, and Transaction::Script which one can execute code that mutates the resources on chain.
This diff will NOT be a breaking change as we still keep the functionality of processing Transaction::Program in the VM so that we will have some time to break the backward incompatibility there.
I removed the repl in this PR as well. Reason being that the local cli will have a superset of the functionality provided by the repl.
Have you read the Contributing Guidelines on pull requests?
(Write your answer here.)
Test Plan
(Share your test plan here. If you changed code, please provide us with clear instructions for verifying that your changes work.)
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/libra/website, and link to your PR here.)