Skip to content

Commit 2f3b738

Browse files
authored
Package version 21 (#1394)
This is a followup to #1384 that ungates the `unstable-next-api` feature code (and deletes the previous variants) and sets the package version to 21.0.0
1 parent 96a3562 commit 2f3b738

5 files changed

Lines changed: 16 additions & 99 deletions

File tree

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ exclude = ["soroban-test-wasms/wasm-workspace"]
2020
# NB: When bumping the major version make sure to clean up the
2121
# code guarded by `unstable-*` features to make it enabled
2222
# unconditionally.
23-
version = "20.3.0"
23+
version = "21.0.0"
2424
rust-version = "1.74.0"
2525

2626
[workspace.dependencies]
27-
soroban-env-common = { version = "=20.3.0", path = "soroban-env-common", default-features = false }
28-
soroban-env-guest = { version = "=20.3.0", path = "soroban-env-guest" }
29-
soroban-env-host = { version = "=20.3.0", path = "soroban-env-host" }
30-
soroban-env-macros = { version = "=20.3.0", path = "soroban-env-macros" }
31-
soroban-builtin-sdk-macros = { version = "=20.3.0", path = "soroban-builtin-sdk-macros" }
27+
soroban-env-common = { version = "=21.0.0", path = "soroban-env-common", default-features = false }
28+
soroban-env-guest = { version = "=21.0.0", path = "soroban-env-guest" }
29+
soroban-env-host = { version = "=21.0.0", path = "soroban-env-host" }
30+
soroban-env-macros = { version = "=21.0.0", path = "soroban-env-macros" }
31+
soroban-builtin-sdk-macros = { version = "=21.0.0", path = "soroban-builtin-sdk-macros" }
3232
# NB: this must match the wasmparser version wasmi is using
3333
wasmparser = "=0.116.1"
3434

soroban-env-host/src/e2e_invoke.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use std::{cmp::max, rc::Rc};
66

77
use crate::ledger_info::get_key_durability;
8-
#[cfg(any(test, feature = "unstable-next-api"))]
98
use crate::storage::EntryWithLiveUntil;
109
#[cfg(any(test, feature = "recording_mode"))]
1110
use crate::{
@@ -80,7 +79,6 @@ pub struct InvokeHostFunctionRecordingModeResult {
8079
pub contract_events: Vec<ContractEvent>,
8180
/// Size of the encoded contract events and the return value.
8281
/// Non-zero only when invocation has succeeded.
83-
#[cfg(any(test, feature = "unstable-next-api"))]
8482
pub contract_events_and_return_value_size: u32,
8583
}
8684

@@ -160,14 +158,7 @@ pub fn get_ledger_changes(
160158
new_live_until_ledger: 0,
161159
});
162160
}
163-
#[cfg(any(test, feature = "unstable-next-api"))]
164161
let entry_with_live_until = init_storage_snapshot.get(key)?;
165-
#[cfg(not(any(test, feature = "unstable-next-api")))]
166-
let entry_with_live_until = if init_storage_snapshot.has(key)? {
167-
Some(init_storage_snapshot.get(key)?)
168-
} else {
169-
None
170-
};
171162
if let Some((old_entry, old_live_until_ledger)) = entry_with_live_until {
172163
let mut buf = vec![];
173164
metered_write_xdr(budget, old_entry.as_ref(), &mut buf)?;
@@ -567,14 +558,7 @@ pub fn invoke_host_function_in_recording_mode(
567558
let mut encoded_ttl_entries = Vec::with_capacity(storage.footprint.0.len());
568559
let mut read_bytes = 0_u32;
569560
for (lk, _) in &storage.footprint.0 {
570-
#[cfg(any(test, feature = "unstable-next-api"))]
571561
let entry_with_live_until = ledger_snapshot.get(lk)?;
572-
#[cfg(not(any(test, feature = "unstable-next-api")))]
573-
let entry_with_live_until = if ledger_snapshot.has(lk)? {
574-
Some(ledger_snapshot.get(lk)?)
575-
} else {
576-
None
577-
};
578562
if let Some((le, live_until)) = entry_with_live_until {
579563
let encoded_le = host.to_xdr_non_metered(&*le)?;
580564
read_bytes = read_bytes.saturating_add(encoded_le.len() as u32);
@@ -652,7 +636,6 @@ pub fn invoke_host_function_in_recording_mode(
652636
auth: output_auth,
653637
ledger_changes,
654638
contract_events,
655-
#[cfg(any(test, feature = "unstable-next-api"))]
656639
contract_events_and_return_value_size,
657640
})
658641
}
@@ -831,7 +814,6 @@ struct StorageMapSnapshotSource<'a> {
831814
map: &'a StorageMap,
832815
}
833816

834-
#[cfg(any(test, feature = "unstable-next-api"))]
835817
impl<'a> SnapshotSource for StorageMapSnapshotSource<'a> {
836818
fn get(&self, key: &Rc<LedgerKey>) -> Result<Option<EntryWithLiveUntil>, HostError> {
837819
if let Some(Some((entry, live_until_ledger))) =
@@ -843,30 +825,3 @@ impl<'a> SnapshotSource for StorageMapSnapshotSource<'a> {
843825
}
844826
}
845827
}
846-
847-
#[cfg(not(any(test, feature = "unstable-next-api")))]
848-
impl<'a> SnapshotSource for StorageMapSnapshotSource<'a> {
849-
fn get(&self, key: &Rc<LedgerKey>) -> Result<(Rc<LedgerEntry>, Option<u32>), HostError> {
850-
if let Some(Some((entry, live_until_ledger))) =
851-
self.map.get::<Rc<LedgerKey>>(key, self.budget)?
852-
{
853-
Ok((Rc::clone(entry), *live_until_ledger))
854-
} else {
855-
Err(HostError::from((
856-
ScErrorType::Storage,
857-
ScErrorCode::InternalError,
858-
)))
859-
}
860-
}
861-
862-
fn has(&self, key: &Rc<LedgerKey>) -> Result<bool, HostError> {
863-
if let Some(maybe_value) = self.map.get::<Rc<LedgerKey>>(key, self.budget)? {
864-
Ok(maybe_value.is_some())
865-
} else {
866-
Err(HostError::from((
867-
ScErrorType::Storage,
868-
ScErrorCode::InternalError,
869-
)))
870-
}
871-
}
872-
}

soroban-env-host/src/storage.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,12 @@ pub enum AccessType {
5555
/// A helper type used by [FootprintMode::Recording] to provide access
5656
/// to a stable read-snapshot of a ledger.
5757
/// The snapshot is expected to only return live ledger entries.
58-
#[cfg(any(test, feature = "unstable-next-api"))]
5958
pub trait SnapshotSource {
6059
/// Returns the ledger entry for the key and its live_until ledger if entry
6160
/// exists, or `None` otherwise.
6261
fn get(&self, key: &Rc<LedgerKey>) -> Result<Option<EntryWithLiveUntil>, HostError>;
6362
}
6463

65-
#[cfg(not(any(test, feature = "unstable-next-api")))]
66-
pub trait SnapshotSource {
67-
// Returns the ledger entry for the key and its live_until ledger.
68-
fn get(&self, key: &Rc<LedgerKey>) -> Result<EntryWithLiveUntil, HostError>;
69-
fn has(&self, key: &Rc<LedgerKey>) -> Result<bool, HostError>;
70-
}
71-
7264
/// Describes the total set of [LedgerKey]s that a given transaction
7365
/// will access, as well as the [AccessType] governing each key.
7466
///
@@ -471,16 +463,7 @@ impl Storage {
471463
// In recording mode we treat the map as a cache
472464
// that misses read-through to the underlying src.
473465
if !self.map.contains_key::<Rc<LedgerKey>>(key, budget)? {
474-
#[cfg(any(test, feature = "unstable-next-api"))]
475466
let value = src.get(&key)?;
476-
477-
#[cfg(not(any(test, feature = "unstable-next-api")))]
478-
let value = if src.has(&key)? {
479-
Some(src.get(key)?)
480-
} else {
481-
None
482-
};
483-
484467
self.map = self.map.insert(key.clone(), value, budget)?;
485468
}
486469
}

soroban-env-host/src/testutils.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::e2e_invoke::ledger_entry_to_ledger_key;
2-
#[cfg(any(test, feature = "unstable-next-api"))]
32
use crate::storage::EntryWithLiveUntil;
43
use crate::{
54
budget::Budget,
@@ -134,7 +133,6 @@ impl MockSnapshotSource {
134133
}
135134
}
136135

137-
#[cfg(any(test, feature = "unstable-next-api"))]
138136
impl SnapshotSource for MockSnapshotSource {
139137
fn get(&self, key: &Rc<LedgerKey>) -> Result<Option<EntryWithLiveUntil>, HostError> {
140138
if let Some((entry, live_until)) = self.0.get(key) {
@@ -145,25 +143,6 @@ impl SnapshotSource for MockSnapshotSource {
145143
}
146144
}
147145

148-
#[cfg(not(any(test, feature = "unstable-next-api")))]
149-
impl SnapshotSource for MockSnapshotSource {
150-
fn get(&self, key: &Rc<LedgerKey>) -> Result<(Rc<LedgerEntry>, Option<u32>), HostError> {
151-
if let Some(val) = self.0.get(key) {
152-
Ok((Rc::clone(&val.0), val.1))
153-
} else {
154-
Err((
155-
crate::xdr::ScErrorType::Storage,
156-
crate::xdr::ScErrorCode::MissingValue,
157-
)
158-
.into())
159-
}
160-
}
161-
162-
fn has(&self, key: &Rc<LedgerKey>) -> Result<bool, HostError> {
163-
Ok(self.0.contains_key(key))
164-
}
165-
}
166-
167146
#[cfg(test)]
168147
pub(crate) fn interface_meta_with_custom_versions(proto: u32, pre: u32) -> Vec<u8> {
169148
use crate::xdr::{Limited, Limits, ScEnvMetaEntry, WriteXdr};

0 commit comments

Comments
 (0)