Skip to content

Commit 350f37d

Browse files
committed
Integrate unstable-next-api into curr (dropped arg)
1 parent 931e341 commit 350f37d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

cmd/stellar-rpc/lib/preflight/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ mod curr {
4141
pub(crate) mod shared;
4242

4343
pub(crate) const PROTOCOL: u32 = soroban_env_host::meta::INTERFACE_VERSION.protocol;
44+
45+
// soroban-simulation-curr with unstable-next-api no longer takes bucket_list_size.
46+
pub(crate) fn load_network_config(
47+
snapshot: &impl soroban_env_host::storage::SnapshotSource,
48+
_bucket_list_size: u64,
49+
) -> crate::Result<soroban_simulation::NetworkConfig> {
50+
soroban_simulation::NetworkConfig::load_from_snapshot(snapshot)
51+
}
4452
}
4553

4654
#[path = "."]
@@ -52,6 +60,13 @@ mod prev {
5260
pub(crate) mod shared;
5361

5462
pub(crate) const PROTOCOL: u32 = soroban_env_host::meta::INTERFACE_VERSION.protocol;
63+
64+
pub(crate) fn load_network_config(
65+
snapshot: &impl soroban_env_host::storage::SnapshotSource,
66+
bucket_list_size: u64,
67+
) -> crate::Result<soroban_simulation::NetworkConfig> {
68+
soroban_simulation::NetworkConfig::load_from_snapshot(snapshot, bucket_list_size)
69+
}
5570
}
5671

5772
use std::cell::RefCell;

cmd/stellar-rpc/lib/preflight/src/shared.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub(crate) fn preflight_invoke_hf_op_or_maybe_panic(
129129

130130
let go_storage = Rc::new(GoLedgerStorage::new(handle));
131131
let network_config =
132-
NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?;
132+
super::load_network_config(go_storage.as_ref(), c_ledger_info.bucket_list_size)?;
133133
let ledger_info = fill_ledger_info(c_ledger_info, &network_config);
134134

135135
let mut adjustment_config = SimulationAdjustmentConfig::default_adjustment();
@@ -212,7 +212,7 @@ pub(crate) fn preflight_footprint_ttl_op_or_maybe_panic(
212212
LedgerFootprint::from_xdr(unsafe { from_c_xdr(footprint) }, DEFAULT_XDR_RW_LIMITS)?;
213213
let go_storage = Rc::new(GoLedgerStorage::new(handle));
214214
let network_config =
215-
NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?;
215+
super::load_network_config(go_storage.as_ref(), c_ledger_info.bucket_list_size)?;
216216
let ledger_info = fill_ledger_info(c_ledger_info, &network_config);
217217
// TODO: It would make for a better UX if the user passed only the necessary fields for every operation.
218218
// That would remove a possibility of providing bad operation body, or a possibility of filling wrong footprint

0 commit comments

Comments
 (0)