-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[aptos-sdk-builder] Rebrand and re-emerge transaction-builder-generator #2151
Conversation
Quick question: does this now also work again? Because it crashed after the module renaming and was deactivated. (Both for cached and framework run.) |
Yup, I fixed it. First had to improve the upstream library to determine why it was exploding and then had to fix this. Apparently it was missing "TypeTag", which is sad because that was what we were looking to generate but failing to do so. Mind you, it passed some tests, so I'm curious to see if it passes the litany of tests we have. 🤞 |
Great! Can we keep the generated files checked in, and have a little shell to regenerate those guys? I don't want to go to the same ordeal again. In general there are two issues with the previous setup:
|
This is a tricky situation, because on the one hand, you're right it is a pain in the ass. On the other hand, it builds uncomfortable nuance into the codebase -- that is, I must re-run the builder and copy the file over. Let me explore a couple solutions that might ... automate this. |
The most straightforward way is to build a test for this. We are doing this in the Move repo for generated artifacts like docs. See the Practically there is little need to automate this since only a few people will run into the need to re-run this, and they should know what they are doing/need to do. |
No copy should be needed. This should be done in Rust. (And also the test logic -- its like a baseline test.) |
@@ -14,8 +14,8 @@ anyhow = "1.0.57" | |||
bcs = "0.1.3" | |||
heck = "0.3.2" | |||
regex = "1.5.5" | |||
serde-generate = { git = "https://github.com/aptos-labs/serde-reflection" } | |||
serde-reflection = { git = "https://github.com/aptos-labs/serde-reflection" } | |||
serde-generate = { git = "https://github.com/aptos-labs/serde-reflection", rev = "9ba2437dc079515f5a1797b8536b0ea7685678d0" } |
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.
what is this?
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 upstream serde reflection has issues, we forked a while ago. Once we get into a good place, I'll chat with Mathieu about potentially using his.
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 not upstream though? isn’t this our fork?
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.
Yes.
@@ -14,7 +14,7 @@ fn main() { | |||
no_check_layout_compatibility: false, | |||
no_build_docs: false, | |||
with_diagram: false, | |||
no_script_builder: true, // TODO: consider bringing this back | |||
no_script_builder: false, |
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.
what does this do?
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.
turns generation of the script builder back on.
@@ -25,7 +25,7 @@ fn initial_aptos_version() { | |||
println!("@@@@@@@@@@@@ account {:?}", account); |
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.
Oh crap this looks like mine. Can you please remove it? I'm surprised lint didn't catch this.
@@ -25,7 +25,7 @@ fn initial_aptos_version() { | |||
println!("@@@@@@@@@@@@ account {:?}", account); | |||
let txn = account | |||
.transaction() | |||
.payload(aptos_stdlib::encode_version_set_version(test_env.version_number + 1)) | |||
.payload(aptos_stdlib::version_set_version(test_env.version_number + 1)) | |||
.sequence_number(test_env.dr_sequence_number) | |||
.sign(); | |||
println!("@@@@@@@@@@@@ txn {:?}", txn); |
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.
Same here.
* Upgraded to a newer version that spit out more clean errors * Fixed the missing TypeTag * Remove encode and decode prefixes from functions * Adjusted to new casing of module names * Remove blocklist of unsupported functions
PR should be ready for review and hopefully landing, so I can focus on the next big challenge :) |
Now that the former transaction-generator-builder is healthy, I've reintroduced it. I've removed the unnecessary encode_ prefix and updated the functions appropriately.
For move arguments, VecBytes and Vec<Vec<u8>> should be interchangeable. The former is more natural, since theoretically, we can have nested vectors of other types.
@@ -3,29 +3,15 @@ | |||
|
|||
#![allow(unused_imports)] |
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.
why is not this called aptos_stdlib_builder?
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.
hahaha, probably should rename these to just lib and no builder.
@@ -34,7 +34,7 @@ fn quote_type_as_format(type_tag: &TypeTag) -> Format { | |||
U8 => Format::Bytes, | |||
Vector(type_tag) => { | |||
if type_tag.as_ref() == &U8 { | |||
Format::TypeName("VecBytes".into()) |
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.
we may want to keep consistent with the types in move repo. If we need to change anything on the parsing of VecBytes in move repo, it would be much easier to use existing types.
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.
VecBytes are a hack as far as I can tell. We should probably work with the team to remove them. Also move doesn't really have a notion of "transaction agruments".
✅ Forge test successForge is land-blocking
|
✅ Forge test successForge is land-blocking
|
SDK files are useful for ides and general code readability. This stores them in the repo. They will automatically be rebuilt each time the user builds cached-framework to make it easier to keep them up to date without the user needing to explicitly figure this out.
✅ Forge test successForge is land-blocking
|
This change is