@@ -1436,18 +1436,15 @@ impl<'a, Ext, Db: Database, TrevmState: HasTx> Trevm<'a, Ext, Db, TrevmState> {
1436
1436
// -- NEEDS TX with State<Db>
1437
1437
1438
1438
impl < Ext , Db : Database + StateAcc > EvmNeedsTx < ' _ , Ext , Db > {
1439
- /// Apply block overrides to the current block. This function is
1440
- /// intended to be used by shared states, where mutable access may fail, e.
1441
- /// g. an `Arc<Db>`. Prefer [`Self::try_apply_block_overrides`] when
1442
- /// available.
1439
+ /// Apply block overrides to the current block.
1443
1440
///
1444
1441
/// Note that this is NOT reversible. The overrides are applied directly to
1445
1442
/// the underlying state and these changes cannot be removed. If it is
1446
1443
/// important that you have access to the pre-change state, you should wrap
1447
1444
/// the existing DB in a new [`State`] and apply the overrides to that.
1448
1445
///
1449
1446
/// [`State`]: revm::db::State
1450
- pub fn try_apply_block_overrides ( mut self , overrides : & BlockOverrides ) -> Self {
1447
+ pub fn apply_block_overrides ( mut self , overrides : & BlockOverrides ) -> Self {
1451
1448
overrides. fill_block ( & mut self . inner ) ;
1452
1449
1453
1450
if let Some ( hashes) = overrides. block_hash . as_ref ( ) {
@@ -1457,36 +1454,36 @@ impl<Ext, Db: Database + StateAcc> EvmNeedsTx<'_, Ext, Db> {
1457
1454
self
1458
1455
}
1459
1456
1460
- /// Apply block overrides to the current block, if they are provided. This
1461
- /// function is intended to be used by shared states, where mutable access
1462
- /// may fail, e.g. an `Arc<Db>`.Prefer
1463
- /// [`Self::try_maybe_apply_block_overrides`] when available.
1457
+ /// Apply block overrides to the current block, if they are provided.
1464
1458
///
1465
1459
/// Note that this is NOT reversible. The overrides are applied directly to
1466
1460
/// the underlying state and these changes cannot be removed. If it is
1467
1461
/// important that you have access to the pre-change state, you should wrap
1468
1462
/// the existing DB in a new [`State`] and apply the overrides to that.
1469
1463
///
1470
1464
/// [`State`]: revm::db::State
1471
- pub fn try_maybe_apply_block_overrides ( self , overrides : Option < & BlockOverrides > ) -> Self {
1465
+ pub fn maybe_apply_block_overrides ( self , overrides : Option < & BlockOverrides > ) -> Self {
1472
1466
if let Some ( overrides) = overrides {
1473
- self . try_apply_block_overrides ( overrides)
1467
+ self . apply_block_overrides ( overrides)
1474
1468
} else {
1475
1469
self
1476
1470
}
1477
1471
}
1478
1472
}
1479
1473
1480
1474
impl < ' a , Ext , Db : Database + TryStateAcc > EvmNeedsTx < ' a , Ext , Db > {
1481
- /// Apply block overrides to the current block.
1475
+ /// Apply block overrides to the current block. This function is
1476
+ /// intended to be used by shared states, where mutable access may fail, e.
1477
+ /// g. an `Arc<Db>`. Prefer [`Self::apply_block_overrides`] when
1478
+ /// available.
1482
1479
///
1483
1480
/// Note that this is NOT reversible. The overrides are applied directly to
1484
1481
/// the underlying state and these changes cannot be removed. If it is
1485
1482
/// important that you have access to the pre-change state, you should wrap
1486
1483
/// the existing DB in a new [`State`] and apply the overrides to that.
1487
1484
///
1488
1485
/// [`State`]: revm::db::State
1489
- pub fn apply_block_overrides (
1486
+ pub fn try_apply_block_overrides (
1490
1487
mut self ,
1491
1488
overrides : & BlockOverrides ,
1492
1489
) -> Result < Self , EvmErrored < ' a , Ext , Db , <Db as TryStateAcc >:: Error > > {
@@ -1499,20 +1496,23 @@ impl<'a, Ext, Db: Database + TryStateAcc> EvmNeedsTx<'a, Ext, Db> {
1499
1496
Ok ( self )
1500
1497
}
1501
1498
1502
- /// Apply block overrides to the current block, if they are provided.
1499
+ /// Apply block overrides to the current block, if they are provided. This
1500
+ /// function is intended to be used by shared states, where mutable access
1501
+ /// may fail, e.g. an `Arc<Db>`.Prefer
1502
+ /// [`Self::maybe_apply_block_overrides`] when available.
1503
1503
///
1504
1504
/// Note that this is NOT reversible. The overrides are applied directly to
1505
1505
/// the underlying state and these changes cannot be removed. If it is
1506
1506
/// important that you have access to the pre-change state, you should wrap
1507
1507
/// the existing DB in a new [`State`] and apply the overrides to that.
1508
1508
///
1509
1509
/// [`State`]: revm::db::State
1510
- pub fn maybe_apply_block_overrides (
1510
+ pub fn try_maybe_apply_block_overrides (
1511
1511
self ,
1512
1512
overrides : Option < & BlockOverrides > ,
1513
1513
) -> Result < Self , EvmErrored < ' a , Ext , Db , <Db as TryStateAcc >:: Error > > {
1514
1514
if let Some ( overrides) = overrides {
1515
- self . apply_block_overrides ( overrides)
1515
+ self . try_apply_block_overrides ( overrides)
1516
1516
} else {
1517
1517
Ok ( self )
1518
1518
}
0 commit comments