Skip to content

Commit 1b4cdc5

Browse files
committed
!fixup remove check_same_env function
1 parent 5149c9f commit 1b4cdc5

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

soroban-sdk/src/env.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,15 +447,6 @@ impl Env {
447447
pub fn logs(&self) -> Logs {
448448
Logs::new(self)
449449
}
450-
451-
pub(crate) fn check_same_env(&self, _other: &Self) {
452-
#[cfg(not(target_family = "wasm"))]
453-
if !self.env_impl.is_same(&_other.env_impl) {
454-
panic!("operation performed on values from different `Env`s")
455-
}
456-
// For Wasm builds there is only one (guest) env, so this check is a
457-
// no-op.
458-
}
459450
}
460451

461452
#[doc(hidden)]

soroban-sdk/src/num.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ impl U256 {
217217
}
218218

219219
pub fn from_be_bytes(env: &Env, bytes: &Bytes) -> Self {
220-
env.check_same_env(bytes.env());
221220
let val = env
222221
.u256_val_from_be_bytes(bytes.to_object())
223222
.unwrap_infallible();
@@ -247,7 +246,6 @@ impl U256 {
247246
}
248247

249248
pub fn add(&self, other: &U256) -> U256 {
250-
self.env.check_same_env(&other.env);
251249
let val = self.env.u256_add(self.val, other.val).unwrap_infallible();
252250
U256 {
253251
env: self.env.clone(),
@@ -256,7 +254,6 @@ impl U256 {
256254
}
257255

258256
pub fn sub(&self, other: &U256) -> U256 {
259-
self.env.check_same_env(&other.env);
260257
let val = self.env.u256_sub(self.val, other.val).unwrap_infallible();
261258
U256 {
262259
env: self.env.clone(),
@@ -265,7 +262,6 @@ impl U256 {
265262
}
266263

267264
pub fn mul(&self, other: &U256) -> U256 {
268-
self.env.check_same_env(&other.env);
269265
let val = self.env.u256_mul(self.val, other.val).unwrap_infallible();
270266
U256 {
271267
env: self.env.clone(),
@@ -274,7 +270,6 @@ impl U256 {
274270
}
275271

276272
pub fn div(&self, other: &U256) -> U256 {
277-
self.env.check_same_env(&other.env);
278273
let val = self.env.u256_div(self.val, other.val).unwrap_infallible();
279274
U256 {
280275
env: self.env.clone(),
@@ -283,7 +278,6 @@ impl U256 {
283278
}
284279

285280
pub fn rem_euclid(&self, other: &U256) -> U256 {
286-
self.env.check_same_env(&other.env);
287281
let val = self
288282
.env
289283
.u256_rem_euclid(self.val, other.val)
@@ -372,7 +366,6 @@ impl I256 {
372366
}
373367

374368
pub fn from_be_bytes(env: &Env, bytes: &Bytes) -> Self {
375-
env.check_same_env(bytes.env());
376369
let val = env
377370
.i256_val_from_be_bytes(bytes.to_object())
378371
.unwrap_infallible();
@@ -404,7 +397,6 @@ impl I256 {
404397
}
405398

406399
pub fn add(&self, other: &I256) -> I256 {
407-
self.env.check_same_env(&other.env);
408400
let val = self.env.i256_add(self.val, other.val).unwrap_infallible();
409401
I256 {
410402
env: self.env.clone(),
@@ -413,7 +405,6 @@ impl I256 {
413405
}
414406

415407
pub fn sub(&self, other: &I256) -> I256 {
416-
self.env.check_same_env(&other.env);
417408
let val = self.env.i256_sub(self.val, other.val).unwrap_infallible();
418409
I256 {
419410
env: self.env.clone(),
@@ -422,7 +413,6 @@ impl I256 {
422413
}
423414

424415
pub fn mul(&self, other: &I256) -> I256 {
425-
self.env.check_same_env(&other.env);
426416
let val = self.env.i256_mul(self.val, other.val).unwrap_infallible();
427417
I256 {
428418
env: self.env.clone(),
@@ -431,7 +421,6 @@ impl I256 {
431421
}
432422

433423
pub fn div(&self, other: &I256) -> I256 {
434-
self.env.check_same_env(&other.env);
435424
let val = self.env.i256_div(self.val, other.val).unwrap_infallible();
436425
I256 {
437426
env: self.env.clone(),
@@ -440,7 +429,6 @@ impl I256 {
440429
}
441430

442431
pub fn rem_euclid(&self, other: &I256) -> I256 {
443-
self.env.check_same_env(&other.env);
444432
let val = self
445433
.env
446434
.i256_rem_euclid(self.val, other.val)

0 commit comments

Comments
 (0)