diff --git a/cmd/soroban-cli/src/commands/contract/bump.rs b/cmd/soroban-cli/src/commands/contract/bump.rs index c39a61155e..cf21984707 100644 --- a/cmd/soroban-cli/src/commands/contract/bump.rs +++ b/cmd/soroban-cli/src/commands/contract/bump.rs @@ -5,13 +5,14 @@ use std::{ }; use clap::{command, Parser}; +use sha2::{Digest, Sha256}; use soroban_env_host::xdr::{ BumpFootprintExpirationOp, Error as XdrError, ExpirationEntry, ExtensionPoint, Hash, LedgerEntry, LedgerEntryChange, LedgerEntryData, LedgerFootprint, LedgerKey, - LedgerKeyContractCode, LedgerKeyContractData, Memo, MuxedAccount, Operation, OperationBody, - Preconditions, ReadXdr, ScAddress, ScSpecTypeDef, ScVal, SequenceNumber, SorobanResources, - SorobanTransactionData, Transaction, TransactionExt, TransactionMeta, TransactionMetaV3, - Uint256, + LedgerKeyContractCode, LedgerKeyContractData, LedgerKeyExpiration, Memo, MuxedAccount, + Operation, OperationBody, Preconditions, ReadXdr, ScAddress, ScSpecTypeDef, ScVal, + SequenceNumber, SorobanResources, SorobanTransactionData, Transaction, TransactionExt, + TransactionMeta, TransactionMetaV3, Uint256, WriteXdr, }; use stellar_strkey::DecodeError; @@ -165,7 +166,7 @@ impl Cmd { ext: ExtensionPoint::V0, resources: SorobanResources { footprint: LedgerFootprint { - read_only: vec![needle].try_into()?, + read_only: vec![needle.clone()].try_into()?, read_write: vec![].try_into()?, }, instructions: 0, @@ -179,7 +180,19 @@ impl Cmd { let (result, meta, events) = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - + let entries = client + .get_ledger_entries(&[ + LedgerKey::Expiration(LedgerKeyExpiration { + key_hash: Hash( + Sha256::digest(needle.clone().to_xdr_base64()?.as_bytes()).into(), + ), + }), + needle, + ]) + .await?; + let entries = entries.entries.ok_or(Error::LedgerEntryNotFound)?; + tracing::trace!("entries:\n{entries:#?}"); + tracing::trace!("{:#?}", LedgerEntryData::from_xdr_base64(&entries[0].xdr)); tracing::trace!(?result); tracing::trace!("Meta:\n {meta:#?}"); if !events.is_empty() {