From 57748ea390956f377d38c730c62a17c5925cddca Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Wed, 22 Jan 2025 19:23:50 +0100 Subject: [PATCH] fix(sui): fix PTB upgrade command (#20936) # Description of change Fix the PTB upgrade command by converting the package_digest to a vector instead of an array, because the .pure() function otherwise doesn't add the required length prefix byte. Porting over https://github.com/iotaledger/iota/pull/4960 ## Type of change - Bug fix (a non-breaking change which fixes an issue) ## How the change has been tested Upgrading a package with a PTB command: `sui client ptb --assign upgrade_cap @0x6ed2d8b8587fd559e19e1c9d17a9ce8349abe32ff423df73ddfa2056759e90fc --upgrade . upgrade_cap` https://testnet.suivision.xyz/txblock/44egvNom79HtLwQinXcpenLbYfex3QSDriGzBpfk58Yx --- crates/sui/src/client_ptb/builder.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/sui/src/client_ptb/builder.rs b/crates/sui/src/client_ptb/builder.rs index f702a9bdb397d..f8ea01cc5b3c2 100644 --- a/crates/sui/src/client_ptb/builder.rs +++ b/crates/sui/src/client_ptb/builder.rs @@ -1043,7 +1043,8 @@ impl<'a> PTBBuilder<'a> { .map_err(|e| err!(cmd_span, "{e}"))?; let digest_arg = self .ptb - .pure(package_digest) + // .to_vec() is necessary to get the length prefix + .pure(package_digest.to_vec()) .map_err(|e| err!(cmd_span, "{e}"))?; let upgrade_ticket = self.ptb.command(Tx::Command::move_call( SUI_FRAMEWORK_PACKAGE_ID,