Skip to content

Commit

Permalink
fix(sui): fix PTB upgrade command (#20936)
Browse files Browse the repository at this point in the history
# 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 iotaledger/iota#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
  • Loading branch information
Thoralf-M authored Jan 22, 2025
1 parent 8f65446 commit 57748ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/sui/src/client_ptb/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 57748ea

Please sign in to comment.