-
Notifications
You must be signed in to change notification settings - Fork 7
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
Transaction Builder #41
base: master
Are you sure you want to change the base?
Conversation
Thanks so much for the review @amnn 🚀 |
28d7deb
to
17d7187
Compare
6e59091
to
693ffbc
Compare
Bring in the macros for |
@amnn @bmwill I added a basic Move project and changed the CI and Makefile to build it and get the modules, dependencies, and digest from the build instead of hard coding them. I think I've addressed most comments and the only thing that's left is errors. |
I can't figure out why the CI fails on PR but not on push. |
Have you rebased on the latest tip of master? |
I did, unless I messed something up. I will retry. |
Double checked, it's rebased on master branch. 😢 |
f28f8f9
to
e8767cd
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.
A small issue with IntoInput
and in particular the way it's implemented for Object
, but otherwise this is good to go in my book! 🚀 well done @stefan-mysten
/// A trait to convert a type into an [`unresolved::Input`]. This is mostly used for gas objects, | ||
/// to pass them either as literals, as an object id, as a reference to an object, or as a | ||
/// [`unresolved::Input`] object. | ||
pub trait IntoInput { |
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 its own trait, vs Into<unresolved::Input>
?
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.
unresolved::Input
is not defined into this crate, so I cannot do Into<unresolved::Input>
.
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.
That's not the rule -- you can't implement From<X> for unresolved::Input
because it's from a different crate. You're fine to implement Into<unresolved::Input> for X
.
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.
Maybe I am doing something wrong or maybe it's a new rule in Rust 1.81?
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> crates/sui-transaction-builder/src/lib.rs:402:1
|
402 | impl Into<unresolved::Input> for &Object {
| ^^^^^-----------------------^^^^^-------
| | | |
| | | `sui_sdk_types::types::Object` is not defined in the current crate
| | `sui_sdk_types::types::unresolved::Input` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
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.
Moved this into unresolved
module.
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 spoke about this offline, but for posterity the issue here is that Object
is from a different crate, not Input
)
objects: self | ||
.gas | ||
.into_iter() | ||
.map(try_from_gas_unresolved_input_to_unresolved_obj_ref) |
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.
Given this is a gas payment we know up front that it has to be an object reference so we should on the client side be able to take a literal and make it an object id.
That works too!
… with --ignore-chain support in --dump-bytecode-as-bas64
318f569
to
ef3de6b
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.
Final round of comments from me, I think -- the latest round of changes opened a Pandora's box around unresolved::Input
(IntoInput
+ the builder API mainly).
Makefile
Outdated
@@ -24,9 +24,12 @@ test: | |||
cargo nextest run --all-features -p sui-sdk-types -p sui-crypto | |||
cargo test --doc | |||
|
|||
package_%.json: |
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 rule needs to depend on the contents of the test package (its Move.toml
and source files), otherwise it won't rebuild when you change them.
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.
Tried to add something but not sure how to test it. Also, because test-with-localnet is phony, I think this rule will always be called?
This is the first iteration on the transaction builder. I expect that it is not 100% correct as there are some areas that I am not sure about, thus I decided to push a PR to get some feedback.
Might be easier to go over it in a call, so we can also do that.