-
Notifications
You must be signed in to change notification settings - Fork 34
feat(cli) add --custom_signer
flag for transactions
#6777
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 ↗︎
|
@arjanjohan is attempting to deploy a commit to the IOTA Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Co-authored-by: DaughterOfMars <[email protected]>
Mind making the release note a bit more descriptive? |
Co-authored-by: DaughterOfMars <[email protected]>
I just updated the release not |
crates/iota/src/client_ptb/parser.rs
Outdated
@@ -110,6 +112,7 @@ impl<'a, I: Iterator<Item = &'a str>> ProgramParser<'a, I> { | |||
match lexeme { | |||
L(T::Command, A::SERIALIZE_UNSIGNED) => flag!(serialize_unsigned_set), | |||
L(T::Command, A::SERIALIZE_SIGNED) => flag!(serialize_signed_set), | |||
L(T::Command, A::CUSTOM_SIGNER) => flag!(custom_signer_set), |
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.
I guess you have to parse the address here and store it somewhere
This currently doesn't work (also without @)
ADDRESS=$(iota client active-address)
cargo run client ptb \
--assign to_address @$ADDRESS \
--split-coins gas "[1000000000]" \
--assign coin \
--transfer-objects "[coin]" to_address \
--custom-signer @0x111111111504e9350e635d65cd38ccd2c029434c6a3a480d8947a9ba6a15b215 \
--serialize-unsigned-transaction
4 │ --transfer-objects [coin] to_address
5 │ --custom-signer @0x111111111504e9350e635d65cd38ccd2c029434c6a3a480d8947a9ba6a15b215
· ┬
· ╰── Unexpected '@'
I think @ should be used to keep it consistent, in the other commands addresses are also marked with an @ before
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.
I just pushed some changes to make it work with the ptb
commands as well, here the @ is required for custom-signer
.
For the 'regular' commands (like cargo run client call
) still work only without @ in the address. That's okay?
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.
I closed this branch by accident after making these changes it seems. I restored it and fixed the merge conflict.
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.
Great, just tried and can confirm that it works now!
Yes, client call without @ is fine
Do you mind also adding a test for the PTB similar to
iota/crates/iota/tests/cli_tests.rs
Lines 4694 to 4716 in f165420
#[sim_test] | |
async fn test_ptb_dev_inspect() -> Result<(), anyhow::Error> { | |
let mut test_cluster = TestClusterBuilder::new() | |
.with_num_validators(2) | |
.build() | |
.await; | |
let context = &mut test_cluster.wallet; | |
let publish_ptb_string = r#" | |
--assign hello_option "some('Hello')" \ | |
--move-call std::option::borrow "<std::string::String>" hello_option \ | |
--dev-inspect | |
"#; | |
let args = shlex::split(publish_ptb_string).unwrap(); | |
let res = iota::client_ptb::ptb::PTB { | |
args, | |
display: HashSet::new(), | |
} | |
.execute(context) | |
.await?; | |
assert!(res.contains("Execution Result\n Return values\n IOTA TypeTag: IotaTypeTag(\"0x1::string::String\")\n Bytes: [5, 72, 101, 108, 108, 111]")); | |
Ok(()) | |
} |
For example use
0xdbcd4c41bd078067c1fed6382ce014771529f37087d02a48f927d678f96064fa
hardcoded as multisig address (no need to actually have the keys, could be a random hash, but I generated it with iota keytool multi-sig-address --pks ADtqJ7zOtqQtYqOo0CpvDXNlMhV3HeJDpjrASKGLWdop --weights 1 --threshold 1
in case I want to use it for other tests in the future as well), then send some funds to it (like here iota/crates/iota/tests/cli_tests.rs
Lines 3852 to 3858 in f165420
let transfer = IotaClientCommands::Transfer { | |
to: KeyIdentity::Address(address2), | |
object_id: object_id1, | |
opts: OptsWithGas::for_testing(Some(object_id1), rgp * TEST_ONLY_GAS_UNIT_FOR_TRANSFER), | |
} | |
.execute(context) | |
.await; |
I can also add this if you are not sure about it, just let me know
Description of change
Add an option
--custom_signer
toiota client
to set a custom sender when creating a transaction.For a hackathon project we built a CLI tool to interact with the IOTA multisig. Under the hood it uses the IOTA CLI, but setting a custom signer on transactions made it impossible to create multisig transactions. See project here.
Links to any relevant issues
Type of change
How the change has been tested
Describe the tests that you ran to verify your changes.
In our hackathon project this version of the IOTA CLI is used to creating and executing multisig transactions.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.
Release Notes
--custom-signer
option toiota client
commands, allowing users to override the default signer address when creating transactions. This enables compatibility with multisig workflows that require specifying a custom sender.