Skip to content

Commit

Permalink
Remove unused reapplyTxSameState
Browse files Browse the repository at this point in the history
  • Loading branch information
mrBliss committed Feb 10, 2020
1 parent 302f374 commit ff1ff9d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,6 @@ instance ApplyTx ByronBlock where
where
validationMode = CC.ValidationMode CC.NoBlockValidation Utxo.TxValidationNoCrypto

reapplyTxSameState cfg tx st =
validationErrorImpossible $
applyByronGenTx validationMode cfg tx st
where
validationMode = CC.ValidationMode CC.NoBlockValidation Utxo.NoTxValidation

instance HasTxId (GenTx ByronBlock) where
data TxId (GenTx ByronBlock)
= ByronTxId !Utxo.TxId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,4 @@ instance ApplyTx ByronSpecBlock where
(byronSpecLedgerState st)

-- Byron spec doesn't have multiple validation modes

reapplyTx cfg tx = applyTx cfg tx
reapplyTxSameState cfg tx = dontExpectError . applyTx cfg tx
where
dontExpectError :: Except a b -> b
dontExpectError mb = case runExcept mb of
Left _ -> error "reapplyTxSameState: unexpected error"
Right b -> b
reapplyTx = applyTx
19 changes: 0 additions & 19 deletions ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Dual.hs
Original file line number Diff line number Diff line change
Expand Up @@ -443,25 +443,6 @@ instance Bridge m a => ApplyTx (DualBlock m a) where
dualLedgerStateBridge
}

reapplyTxSameState DualLedgerConfig{..}
tx@DualGenTx{..}
(TickedLedgerState slot DualLedgerState{..}) =
TickedLedgerState slot DualLedgerState {
dualLedgerStateMain = tickedLedgerState $
reapplyTxSameState
dualLedgerConfigMain
dualGenTxMain
(TickedLedgerState slot dualLedgerStateMain)
, dualLedgerStateAux = tickedLedgerState $
reapplyTxSameState
dualLedgerConfigAux
dualGenTxAux
(TickedLedgerState slot dualLedgerStateAux)
, dualLedgerStateBridge = updateBridgeWithTx
tx
dualLedgerStateBridge
}

instance Bridge m a => HasTxId (GenTx (DualBlock m a)) where
-- We don't need a pair of IDs, as long as we can unique ID the transaction
newtype TxId (GenTx (DualBlock m a)) = DualGenTxId {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,8 @@ instance (SimpleCrypto c, Typeable ext, SupportedBlock (SimpleBlock c ext))

type ApplyTxErr (SimpleBlock c ext) = MockError (SimpleBlock c ext)

applyTx = \_ -> updateSimpleUTxO
reapplyTx = \_ -> updateSimpleUTxO
reapplyTxSameState = \_ -> (mustSucceed . runExcept) .: updateSimpleUTxO
where
mustSucceed (Left _) = error "reapplyTxSameState: unexpected error"
mustSucceed (Right st) = st
applyTx = const updateSimpleUTxO
reapplyTx = const updateSimpleUTxO

instance HasTxId (GenTx (SimpleBlock c ext)) where
newtype TxId (GenTx (SimpleBlock c ext)) = SimpleGenTxId
Expand Down
11 changes: 0 additions & 11 deletions ouroboros-consensus/src/Ouroboros/Consensus/Mempool/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ class ( UpdateLedger blk
-> TickedLedgerState blk
-> Except (ApplyTxErr blk) (TickedLedgerState blk)

-- | Re-apply a transaction to the very same state it was applied in before
--
-- In this case no error can occur.
--
-- See also 'ldbConfReapply' for comments on implementing this function.
reapplyTxSameState :: HasCallStack
=> LedgerConfig blk
-> GenTx blk
-> TickedLedgerState blk
-> TickedLedgerState blk

-- | Transactions with an identifier
--
-- The mempool will use these to locate transactions, so two different
Expand Down

0 comments on commit ff1ff9d

Please sign in to comment.