-
Notifications
You must be signed in to change notification settings - Fork 35
feat(iota): make split-coin command work with a single gas coin #6647
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
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
6372b83
to
7d1de45
Compare
if let Some(amounts) = amounts { | ||
client | ||
.transaction_builder() | ||
.pay_iota_tx_kind(vec![signer; amounts.len()], amounts)? |
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.
Can we not use the actual split command?
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.
Not without breaking change to it, since it uses the provided coin id as input and then you can't use it as gas coin 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.
We can't change the internal functionality?
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.
As far as I know not, as we don't know if the provided object id is also used as gas coin or not
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.
Then where is it failing? I'm confused.
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.
At this point the transaction is built assuming the provided coin is not the gas object, the gas object is selected later. If the gas object is the same as the provided object it will fail, as it was provided twice as input. Without changing the params to the functions we can't change the assumption, that this object is not used also as gas object
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, but why not change it where it checks for the gas object so that this doesn't fail when you try to call it this way. Otherwise using this method via the SDKs will still fail
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 gas object is selected after this step, you can't go back and change it then (at least not without super complicated logic to decode it again and replace stuff)
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.
And yes, this method will fail with the SDK if you only have a single gas coin, but I don't think that this is a big issue and also I don't see a way around this without breaking change, but this is not the only method that would fail in such a case
Description of change
Make
iota client split-coin
work with a single gas coin, by splitting from the gas coin, before this change it would error, as it can't use one coin as gas and as input.Also increased the min count split amount to
2
as it would otherwise just waste gasLinks to any relevant issues
Fixes #6528
Type of change
How the change has been tested
Added test + manual testing
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.
Release Notes
iota client split-coin
work with a single gas coin