diff --git a/Cargo.toml b/Cargo.toml index 99889cb26d..7ccadcac0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,7 @@ path = "cmd/soroban-cli" version = "20.0.0-rc1" git = "https://github.com/stellar/rs-stellar-xdr" rev = "9c97e4fa909a0b6455547a4f4a95800696b2a69a" -default-features = false +default-features = true [workspace.dependencies] base64 = "0.21.2" diff --git a/cmd/crates/soroban-spec-json/src/lib.rs b/cmd/crates/soroban-spec-json/src/lib.rs index e7310ccfd1..cdc64665bd 100644 --- a/cmd/crates/soroban-spec-json/src/lib.rs +++ b/cmd/crates/soroban-spec-json/src/lib.rs @@ -3,8 +3,8 @@ use std::{fs, io}; pub mod types; use sha2::{Digest, Sha256}; -use stellar_xdr::ScSpecEntry; +use stellar_xdr::curr::ScSpecEntry; use types::Entry; use soroban_spec::read::{from_wasm, FromWasmError}; @@ -16,7 +16,7 @@ pub enum GenerateFromFileError { #[error("sha256 does not match, expected: {expected}")] VerifySha256 { expected: String }, #[error("parsing contract spec: {0}")] - Parse(stellar_xdr::Error), + Parse(stellar_xdr::curr::Error), #[error("getting contract spec: {0}")] GetSpec(FromWasmError), } diff --git a/cmd/crates/soroban-spec-json/src/types.rs b/cmd/crates/soroban-spec-json/src/types.rs index 863132ca85..6fcc483e12 100644 --- a/cmd/crates/soroban-spec-json/src/types.rs +++ b/cmd/crates/soroban-spec-json/src/types.rs @@ -1,5 +1,5 @@ use serde::Serialize; -use stellar_xdr::{ +use stellar_xdr::curr::{ ScSpecEntry, ScSpecFunctionInputV0, ScSpecTypeDef, ScSpecUdtEnumCaseV0, ScSpecUdtErrorEnumCaseV0, ScSpecUdtStructFieldV0, ScSpecUdtUnionCaseV0, }; diff --git a/cmd/crates/soroban-spec-tools/src/lib.rs b/cmd/crates/soroban-spec-tools/src/lib.rs index 4458f30e27..a95bc94549 100644 --- a/cmd/crates/soroban-spec-tools/src/lib.rs +++ b/cmd/crates/soroban-spec-tools/src/lib.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use itertools::Itertools; use serde_json::{json, Value}; -use stellar_xdr::{ +use stellar_xdr::curr::{ AccountId, BytesM, ContractExecutable, Error as XdrError, Hash, Int128Parts, Int256Parts, PublicKey, ScAddress, ScBytes, ScContractInstance, ScMap, ScMapEntry, ScNonceKey, ScSpecEntry, ScSpecFunctionV0, ScSpecTypeDef as ScType, ScSpecTypeMap, ScSpecTypeOption, ScSpecTypeResult, @@ -1025,9 +1025,9 @@ pub fn to_json(v: &ScVal) -> Result { .. }) => json!({ "hash": hash }), ScVal::ContractInstance(ScContractInstance { - executable: ContractExecutable::Token, + executable: ContractExecutable::StellarAsset, .. - }) => json!({"token": true}), + }) => json!({"SAC": true}), ScVal::LedgerKeyNonce(ScNonceKey { nonce }) => { Value::Number(serde_json::Number::from(*nonce)) } @@ -1175,11 +1175,10 @@ impl Spec { .iter() .map(|f| { Some(match f { - stellar_xdr::ScSpecUdtUnionCaseV0::VoidV0(ScSpecUdtUnionCaseVoidV0 { - name, - .. - }) => name.to_string_lossy(), - stellar_xdr::ScSpecUdtUnionCaseV0::TupleV0(ScSpecUdtUnionCaseTupleV0 { + ScSpecUdtUnionCaseV0::VoidV0(ScSpecUdtUnionCaseVoidV0 { name, .. }) => { + name.to_string_lossy() + } + ScSpecUdtUnionCaseV0::TupleV0(ScSpecUdtUnionCaseTupleV0 { name, type_, .. @@ -1331,14 +1330,11 @@ impl Spec { .cases .iter() .map(|case| match case { - stellar_xdr::ScSpecUdtUnionCaseV0::VoidV0(ScSpecUdtUnionCaseVoidV0 { - name, - .. - }) => Some(format!("\"{}\"", name.to_string_lossy())), - stellar_xdr::ScSpecUdtUnionCaseV0::TupleV0(ScSpecUdtUnionCaseTupleV0 { - name, - type_, - .. + ScSpecUdtUnionCaseV0::VoidV0(ScSpecUdtUnionCaseVoidV0 { name, .. }) => { + Some(format!("\"{}\"", name.to_string_lossy())) + } + ScSpecUdtUnionCaseV0::TupleV0(ScSpecUdtUnionCaseTupleV0 { + name, type_, .. }) => { if type_.len() == 1 { let single = self.example(&type_[0])?; @@ -1362,7 +1358,7 @@ impl Spec { mod tests { use super::*; - use stellar_xdr::ScSpecTypeBytesN; + use stellar_xdr::curr::ScSpecTypeBytesN; #[test] fn from_json_primitives_bytesn() { diff --git a/cmd/crates/soroban-spec-tools/src/utils.rs b/cmd/crates/soroban-spec-tools/src/utils.rs index f53c24bc95..50cd5ee7ad 100644 --- a/cmd/crates/soroban-spec-tools/src/utils.rs +++ b/cmd/crates/soroban-spec-tools/src/utils.rs @@ -5,7 +5,7 @@ use std::{ io::{self, Cursor}, }; -use stellar_xdr::{ +use stellar_xdr::curr::{ DepthLimitedRead, ReadXdr, ScEnvMetaEntry, ScMetaEntry, ScMetaV0, ScSpecEntry, ScSpecFunctionV0, ScSpecUdtEnumV0, ScSpecUdtErrorEnumV0, ScSpecUdtStructV0, ScSpecUdtUnionV0, StringM, @@ -33,7 +33,7 @@ pub enum Error { error: wasmparser::BinaryReaderError, }, #[error("xdr processing error: {0}")] - Xdr(#[from] stellar_xdr::Error), + Xdr(#[from] stellar_xdr::curr::Error), #[error(transparent)] Parser(#[from] wasmparser::BinaryReaderError), @@ -62,8 +62,7 @@ impl ContractSpec { env_meta_base64 = Some(base64.encode(env_meta)); let cursor = Cursor::new(env_meta); let mut depth_limit_read = DepthLimitedRead::new(cursor, 100); - ScEnvMetaEntry::read_xdr_iter(&mut depth_limit_read) - .collect::, stellar_xdr::Error>>()? + ScEnvMetaEntry::read_xdr_iter(&mut depth_limit_read).collect::, _>>()? } else { vec![] }; @@ -73,8 +72,7 @@ impl ContractSpec { meta_base64 = Some(base64.encode(meta)); let cursor = Cursor::new(meta); let mut depth_limit_read = DepthLimitedRead::new(cursor, 100); - ScMetaEntry::read_xdr_iter(&mut depth_limit_read) - .collect::, stellar_xdr::Error>>()? + ScMetaEntry::read_xdr_iter(&mut depth_limit_read).collect::, _>>()? } else { vec![] }; @@ -84,8 +82,7 @@ impl ContractSpec { spec_base64 = Some(base64.encode(spec)); let cursor = Cursor::new(spec); let mut depth_limit_read = DepthLimitedRead::new(cursor, 100); - ScSpecEntry::read_xdr_iter(&mut depth_limit_read) - .collect::, stellar_xdr::Error>>()? + ScSpecEntry::read_xdr_iter(&mut depth_limit_read).collect::, _>>()? } else { vec![] }; diff --git a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs index ae14ae4760..95b6905915 100644 --- a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs +++ b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs @@ -6,7 +6,7 @@ use std::{ io::Write, path::{Path, PathBuf}, }; -use stellar_xdr::ScSpecEntry; +use stellar_xdr::curr::ScSpecEntry; use super::generate; diff --git a/cmd/crates/soroban-spec-typescript/src/lib.rs b/cmd/crates/soroban-spec-typescript/src/lib.rs index 5e8f8f2101..7dff047563 100644 --- a/cmd/crates/soroban-spec-typescript/src/lib.rs +++ b/cmd/crates/soroban-spec-typescript/src/lib.rs @@ -10,7 +10,7 @@ use crate::types::Type; use heck::ToLowerCamelCase; use itertools::Itertools; use sha2::{Digest, Sha256}; -use stellar_xdr::{ScSpecEntry, WriteXdr}; +use stellar_xdr::curr::{ScSpecEntry, WriteXdr}; use types::Entry; @@ -27,7 +27,7 @@ pub enum GenerateFromFileError { #[error("sha256 does not match, expected: {expected}")] VerifySha256 { expected: String }, #[error("parsing contract spec: {0}")] - Parse(stellar_xdr::Error), + Parse(stellar_xdr::curr::Error), #[error("getting contract spec: {0}")] GetSpec(FromWasmError), } diff --git a/cmd/crates/soroban-spec-typescript/src/types.rs b/cmd/crates/soroban-spec-typescript/src/types.rs index b70bb6836b..350d412967 100644 --- a/cmd/crates/soroban-spec-typescript/src/types.rs +++ b/cmd/crates/soroban-spec-typescript/src/types.rs @@ -1,5 +1,5 @@ use serde::Serialize; -use stellar_xdr::{ +use stellar_xdr::curr::{ ScSpecEntry, ScSpecFunctionInputV0, ScSpecTypeDef, ScSpecUdtEnumCaseV0, ScSpecUdtErrorEnumCaseV0, ScSpecUdtStructFieldV0, ScSpecUdtStructV0, ScSpecUdtUnionCaseV0, }; diff --git a/cmd/soroban-cli/src/commands/contract/deploy.rs b/cmd/soroban-cli/src/commands/contract/deploy.rs index 7c7152bcc4..4cf88e7c03 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy.rs @@ -149,7 +149,7 @@ impl Cmd { &mut state.ledger_entries, contract_id, wasm_hash.0, - state.min_persistent_entry_expiration, + state.min_persistent_entry_ttl, ); self.config.set_state(&state)?; Ok(stellar_strkey::Contract(contract_id).to_string()) diff --git a/cmd/soroban-cli/src/commands/contract/bump.rs b/cmd/soroban-cli/src/commands/contract/extend.rs similarity index 88% rename from cmd/soroban-cli/src/commands/contract/bump.rs rename to cmd/soroban-cli/src/commands/contract/extend.rs index 06a86cf92b..1cd5deea89 100644 --- a/cmd/soroban-cli/src/commands/contract/bump.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -2,10 +2,10 @@ use std::{fmt::Debug, path::Path, str::FromStr}; use clap::{command, Parser}; use soroban_env_host::xdr::{ - BumpFootprintExpirationOp, Error as XdrError, ExpirationEntry, ExtensionPoint, LedgerEntry, - LedgerEntryChange, LedgerEntryData, LedgerFootprint, Memo, MuxedAccount, Operation, - OperationBody, Preconditions, SequenceNumber, SorobanResources, SorobanTransactionData, - Transaction, TransactionExt, TransactionMeta, TransactionMetaV3, Uint256, + Error as XdrError, ExtendFootprintTtlOp, ExtensionPoint, LedgerEntry, LedgerEntryChange, + LedgerEntryData, LedgerFootprint, Memo, MuxedAccount, Operation, OperationBody, Preconditions, + SequenceNumber, SorobanResources, SorobanTransactionData, Transaction, TransactionExt, + TransactionMeta, TransactionMetaV3, TtlEntry, Uint256, }; use crate::{ @@ -114,7 +114,7 @@ impl Cmd { let network = &self.config.get_network()?; let client = Client::new(&network.rpc_url)?; let key = self.config.key_pair()?; - let ledgers_to_expire = self.ledgers_to_expire(); + let extend_to = self.ledgers_to_expire(); // Get the account sequence number let public_strkey = @@ -130,9 +130,9 @@ impl Cmd { memo: Memo::None, operations: vec![Operation { source_account: None, - body: OperationBody::BumpFootprintExpiration(BumpFootprintExpirationOp { + body: OperationBody::ExtendFootprintTtl(ExtendFootprintTtlOp { ext: ExtensionPoint::V0, - ledgers_to_expire, + extend_to, }), }] .try_into()?, @@ -147,7 +147,7 @@ impl Cmd { read_bytes: 0, write_bytes: 0, }, - refundable_fee: 0, + resource_fee: 0, }), }; @@ -161,13 +161,13 @@ impl Cmd { tracing::info!("Events:\n {events:#?}"); } - // The transaction from core will succeed regardless of whether it actually found & bumped + // The transaction from core will succeed regardless of whether it actually found & extended // the entry, so we have to inspect the result meta to tell if it worked or not. let TransactionMeta::V3(TransactionMetaV3 { operations, .. }) = meta else { return Err(Error::LedgerEntryNotFound); }; - // Simply check if there is exactly one entry here. We only support bumping a single + // Simply check if there is exactly one entry here. We only support extending a single // entry via this command (which we should fix separately, but). if operations.len() == 0 { return Err(Error::LedgerEntryNotFound); @@ -176,7 +176,7 @@ impl Cmd { if operations[0].changes.is_empty() { let entry = client.get_full_ledger_entries(&keys).await?; let expire = entry.entries[0].expiration_ledger_seq; - if entry.latest_ledger + i64::from(ledgers_to_expire) < i64::from(expire) { + if entry.latest_ledger + i64::from(extend_to) < i64::from(expire) { return Ok(expire); } } @@ -186,13 +186,13 @@ impl Cmd { LedgerEntryChange::State(_), LedgerEntryChange::Updated(LedgerEntry { data: - LedgerEntryData::Expiration(ExpirationEntry { - expiration_ledger_seq, + LedgerEntryData::Ttl(TtlEntry { + live_until_ledger_seq, .. }), .. }), - ) => Ok(*expiration_ledger_seq), + ) => Ok(*live_until_ledger_seq), _ => Err(Error::LedgerEntryNotFound), } } diff --git a/cmd/soroban-cli/src/commands/contract/fetch.rs b/cmd/soroban-cli/src/commands/contract/fetch.rs index a1284123ef..7c6c98726a 100644 --- a/cmd/soroban-cli/src/commands/contract/fetch.rs +++ b/cmd/soroban-cli/src/commands/contract/fetch.rs @@ -198,7 +198,7 @@ pub fn get_contract_wasm_from_storage( Err(FromWasmError::NotFound) } } - ContractExecutable::Token => todo!(), + ContractExecutable::StellarAsset => todo!(), }, _ => Err(FromWasmError::NotFound), }, diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index 606383ea02..5e05472301 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -68,7 +68,7 @@ impl Cmd { let wasm_hash = utils::add_contract_code_to_ledger_entries( &mut state.ledger_entries, contract, - state.min_persistent_entry_expiration, + state.min_persistent_entry_ttl, )?; self.config.set_state(&state)?; diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 8d83cff7fe..ec6be2ac71 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -9,7 +9,7 @@ use std::{fmt::Debug, fs, io, rc::Rc}; use clap::{arg, command, value_parser, Parser}; use ed25519_dalek::SigningKey; use heck::ToKebabCase; -use soroban_env_host::e2e_invoke::{get_ledger_changes, ExpirationEntryMap}; +use soroban_env_host::e2e_invoke::{get_ledger_changes, TtlEntryMap}; use soroban_env_host::xdr::ReadXdr; use soroban_env_host::{ budget::Budget, @@ -435,16 +435,18 @@ impl Cmd { log_budget(&budget); } - let ledger_changes = - get_ledger_changes(&budget, &storage, &state, ExpirationEntryMap::new())?; - let mut expiration_ledger_bumps: HashMap = HashMap::new(); + let ledger_changes = get_ledger_changes(&budget, &storage, &state, TtlEntryMap::new())?; + let mut expiration_ledger_extensions: HashMap = HashMap::new(); for ledger_entry_change in ledger_changes { - if let Some(exp_change) = ledger_entry_change.expiration_change { + if let Some(exp_change) = ledger_entry_change.ttl_change { let key = xdr::LedgerKey::from_xdr(ledger_entry_change.encoded_key)?; - expiration_ledger_bumps.insert(key, exp_change.new_expiration_ledger); + expiration_ledger_extensions.insert(key, exp_change.new_live_until_ledger); } } - utils::bump_ledger_entry_expirations(&mut state.ledger_entries, &expiration_ledger_bumps); + utils::extend_ledger_entry_expirations( + &mut state.ledger_entries, + &expiration_ledger_extensions, + ); self.config.set_state(&state)?; if !events.0.is_empty() { @@ -463,7 +465,7 @@ impl Cmd { let wasm_hash = utils::add_contract_code_to_ledger_entries( &mut state.ledger_entries, contract, - state.min_persistent_entry_expiration, + state.min_persistent_entry_ttl, ) .map_err(Error::CannotAddContractToLedgerEntries)? .0; @@ -471,7 +473,7 @@ impl Cmd { &mut state.ledger_entries, *contract_id, wasm_hash, - state.min_persistent_entry_expiration, + state.min_persistent_entry_ttl, ); } Ok(()) diff --git a/cmd/soroban-cli/src/commands/contract/mod.rs b/cmd/soroban-cli/src/commands/contract/mod.rs index c2dc1a6775..4ad6946c77 100644 --- a/cmd/soroban-cli/src/commands/contract/mod.rs +++ b/cmd/soroban-cli/src/commands/contract/mod.rs @@ -1,7 +1,7 @@ pub mod bindings; pub mod build; -pub mod bump; pub mod deploy; +pub mod extend; pub mod fetch; pub mod inspect; pub mod install; @@ -22,8 +22,8 @@ pub enum Cmd { /// Extend the expiry ledger of a contract-data ledger entry. /// - /// If no keys are specified the contract itself is bumped. - Bump(bump::Cmd), + /// If no keys are specified the contract itself is extended. + Extend(extend::Cmd), /// Deploy a contract Deploy(deploy::Cmd), @@ -68,7 +68,7 @@ pub enum Error { Build(#[from] build::Error), #[error(transparent)] - Bump(#[from] bump::Error), + Extend(#[from] extend::Error), #[error(transparent)] Deploy(#[from] deploy::Error), @@ -100,7 +100,7 @@ impl Cmd { match &self { Cmd::Bindings(bindings) => bindings.run().await?, Cmd::Build(build) => build.run()?, - Cmd::Bump(bump) => bump.run().await?, + Cmd::Extend(extend) => extend.run().await?, Cmd::Deploy(deploy) => deploy.run().await?, Cmd::Inspect(inspect) => inspect.run()?, Cmd::Install(install) => install.run().await?, diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index b6c8cd3855..0f011e67cd 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -2,17 +2,17 @@ use std::{fmt::Debug, path::Path, str::FromStr}; use clap::{command, Parser}; use soroban_env_host::xdr::{ - Error as XdrError, ExpirationEntry, ExtensionPoint, LedgerEntry, LedgerEntryChange, - LedgerEntryData, LedgerFootprint, Memo, MuxedAccount, Operation, OperationBody, OperationMeta, - Preconditions, RestoreFootprintOp, SequenceNumber, SorobanResources, SorobanTransactionData, - Transaction, TransactionExt, TransactionMeta, TransactionMetaV3, Uint256, + Error as XdrError, ExtensionPoint, LedgerEntry, LedgerEntryChange, LedgerEntryData, + LedgerFootprint, Memo, MuxedAccount, Operation, OperationBody, OperationMeta, Preconditions, + RestoreFootprintOp, SequenceNumber, SorobanResources, SorobanTransactionData, Transaction, + TransactionExt, TransactionMeta, TransactionMetaV3, TtlEntry, Uint256, }; use stellar_strkey::DecodeError; use crate::{ commands::{ config::{self, locator}, - contract::bump, + contract::extend, }, key, rpc::{self, Client}, @@ -78,7 +78,7 @@ pub enum Error { #[error(transparent)] Key(#[from] key::Error), #[error(transparent)] - Bump(#[from] bump::Error), + Extend(#[from] extend::Error), } impl Cmd { @@ -91,7 +91,7 @@ impl Cmd { }; if let Some(ledgers_to_expire) = self.ledgers_to_expire { - bump::Cmd { + extend::Cmd { key: self.key.clone(), ledgers_to_expire, config: self.config.clone(), @@ -145,7 +145,7 @@ impl Cmd { read_bytes: 0, write_bytes: 0, }, - refundable_fee: 0, + resource_fee: 0, }), }; @@ -166,7 +166,7 @@ impl Cmd { }; tracing::debug!("Operations:\nlen:{}\n{operations:#?}", operations.len()); - // Simply check if there is exactly one entry here. We only support bumping a single + // Simply check if there is exactly one entry here. We only support extending a single // entry via this command (which we should fix separately, but). if operations.len() == 0 { return Err(Error::LedgerEntryNotFound); @@ -193,20 +193,20 @@ fn parse_operations(ops: &[OperationMeta]) -> Option { op.changes.iter().find_map(|entry| match entry { LedgerEntryChange::Updated(LedgerEntry { data: - LedgerEntryData::Expiration(ExpirationEntry { - expiration_ledger_seq, + LedgerEntryData::Ttl(TtlEntry { + live_until_ledger_seq, .. }), .. }) | LedgerEntryChange::Created(LedgerEntry { data: - LedgerEntryData::Expiration(ExpirationEntry { - expiration_ledger_seq, + LedgerEntryData::Ttl(TtlEntry { + live_until_ledger_seq, .. }), .. - }) => Some(*expiration_ledger_seq), + }) => Some(*live_until_ledger_seq), _ => None, }) }) diff --git a/cmd/soroban-cli/src/commands/events.rs b/cmd/soroban-cli/src/commands/events.rs index 83809d4281..33cdf18b90 100644 --- a/cmd/soroban-cli/src/commands/events.rs +++ b/cmd/soroban-cli/src/commands/events.rs @@ -341,9 +341,9 @@ mod tests { network_id: [0x1; 32], base_reserve: 5, ledger_entries: vec![], - max_entry_expiration: 6, - min_persistent_entry_expiration: 7, - min_temp_entry_expiration: 8, + min_persistent_entry_ttl: 7, + min_temp_entry_ttl: 6, + max_entry_ttl: 8, }; events_file.commit(&events, &ledger_info, &temp).unwrap(); diff --git a/cmd/soroban-cli/src/commands/lab/token/wrap.rs b/cmd/soroban-cli/src/commands/lab/token/wrap.rs index 4cd2dfb083..62462b21b0 100644 --- a/cmd/soroban-cli/src/commands/lab/token/wrap.rs +++ b/cmd/soroban-cli/src/commands/lab/token/wrap.rs @@ -90,7 +90,7 @@ impl Cmd { let res = h.invoke_function(HostFunction::CreateContract(CreateContractArgs { contract_id_preimage: ContractIdPreimage::Asset(asset.clone()), - executable: ContractExecutable::Token, + executable: ContractExecutable::StellarAsset, }))?; let contract_id = vec_to_hash(&res)?; @@ -185,7 +185,7 @@ fn build_wrap_token_tx( body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { host_function: HostFunction::CreateContract(CreateContractArgs { contract_id_preimage: ContractIdPreimage::Asset(asset.clone()), - executable: ContractExecutable::Token, + executable: ContractExecutable::StellarAsset, }), auth: VecM::default(), }), diff --git a/cmd/soroban-cli/src/rpc/mod.rs b/cmd/soroban-cli/src/rpc/mod.rs index 5123f0f173..4a3b3a3558 100644 --- a/cmd/soroban-cli/src/rpc/mod.rs +++ b/cmd/soroban-cli/src/rpc/mod.rs @@ -777,7 +777,7 @@ soroban config identity fund {address} --helper-url "# ) -> Result { let keys = ledger_keys .iter() - .filter(|key| !matches!(key, LedgerKey::Expiration(_))) + .filter(|key| !matches!(key, LedgerKey::Ttl(_))) .map(Clone::clone) .collect::>(); tracing::trace!("keys: {keys:#?}"); @@ -920,7 +920,7 @@ soroban config identity fund {address} --helper-url "# .map_err(Error::CouldNotParseContractSpec)? .spec), xdr::ScVal::ContractInstance(xdr::ScContractInstance { - executable: xdr::ContractExecutable::Token, + executable: xdr::ContractExecutable::StellarAsset, .. }) => Ok(soroban_spec::read::parse_raw( &token::StellarAssetSpec::spec_xdr(), diff --git a/cmd/soroban-cli/src/rpc/transaction.rs b/cmd/soroban-cli/src/rpc/transaction.rs index f2ed5eeee8..bdd3dfc683 100644 --- a/cmd/soroban-cli/src/rpc/transaction.rs +++ b/cmd/soroban-cli/src/rpc/transaction.rs @@ -274,7 +274,7 @@ mod tests { read_bytes: 5, write_bytes: 0, }, - refundable_fee: 0, + resource_fee: 0, ext: ExtensionPoint::V0, } } diff --git a/cmd/soroban-cli/src/utils.rs b/cmd/soroban-cli/src/utils.rs index 0cbf9dfbc6..08f3f4d5d3 100644 --- a/cmd/soroban-cli/src/utils.rs +++ b/cmd/soroban-cli/src/utils.rs @@ -48,9 +48,9 @@ pub fn ledger_snapshot_read_or_default( // rs-soroban-sdk, but if we don't have them the sandbox doesn't work right. // Oof. // TODO: Remove this hacky workaround. - min_persistent_entry_expiration: 4096, - min_temp_entry_expiration: 16, - max_entry_expiration: 6_312_000, + min_persistent_entry_ttl: 4096, + min_temp_entry_ttl: 16, + max_entry_ttl: 6_312_000, ..Default::default() }) } @@ -138,7 +138,7 @@ pub fn add_contract_to_ledger_entries( )); } -pub fn bump_ledger_entry_expirations( +pub fn extend_ledger_entry_expirations( entries: &mut LedgerSnapshotEntries, lookup: &HashMap, ) { @@ -242,7 +242,7 @@ pub fn get_contract_spec_from_state( }), .. } => match executable { - ContractExecutable::Token => { + ContractExecutable::StellarAsset => { // TODO/FIXME: I don't think it will work for token contracts, since we don't store them in the state? let res = soroban_spec::read::parse_raw(&token::StellarAssetSpec::spec_xdr()); res.map_err(FromWasmError::Parse) diff --git a/cmd/soroban-rpc/lib/preflight/src/fees.rs b/cmd/soroban-rpc/lib/preflight/src/fees.rs index 3e034422b8..3d4c47106d 100644 --- a/cmd/soroban-rpc/lib/preflight/src/fees.rs +++ b/cmd/soroban-rpc/lib/preflight/src/fees.rs @@ -23,6 +23,7 @@ use state_ttl::{get_restored_ledger_sequence, TTLLedgerEntry}; use std::cmp::max; use std::convert::{TryFrom, TryInto}; +#[allow(clippy::too_many_arguments)] pub(crate) fn compute_host_function_transaction_data_and_min_fee( op: &InvokeHostFunctionOp, pre_storage: &LedgerStorage, @@ -224,7 +225,7 @@ fn get_fee_configurations( } // Calculate the implicit TTLEntry bytes that will be read for TTLLedgerEntries -fn calculate_ttl_entry_bytes(ledger_entries: &Vec) -> u32 { +fn calculate_ttl_entry_bytes(ledger_entries: &[LedgerKey]) -> u32 { ledger_entries .iter() .map(|lk| match lk { @@ -372,7 +373,7 @@ fn compute_extend_footprint_rent_changes( ) -> Result> { let mut rent_changes: Vec = Vec::with_capacity(footprint.read_only.len()); - for key in (&footprint).read_only.as_slice() { + for key in footprint.read_only.as_slice() { let unmodified_entry_and_ttl = ledger_storage .get(key, false) .with_context(|| format!("cannot find bump footprint ledger entry with key {key:?}"))?; diff --git a/cmd/soroban-rpc/lib/preflight/src/ledger_storage.rs b/cmd/soroban-rpc/lib/preflight/src/ledger_storage.rs index 276252d76e..3581e69560 100644 --- a/cmd/soroban-rpc/lib/preflight/src/ledger_storage.rs +++ b/cmd/soroban-rpc/lib/preflight/src/ledger_storage.rs @@ -247,7 +247,7 @@ impl SnapshotSource for LedgerStorage { return Ok((entry_and_ttl.0.into(), entry_and_ttl.1)); } let entry_and_ttl = ::get(self, key, false).map_err(HostError::from)?; - return Ok((entry_and_ttl.0.into(), entry_and_ttl.1)); + Ok((entry_and_ttl.0.into(), entry_and_ttl.1)) } fn has(&self, key: &Rc) -> Result {