Skip to content

Commit dd14d69

Browse files
authored
Merge pull request #5260 from IntersectMBO/jj/conway-cleanup
Conway cleanup
2 parents 184986d + a62945c commit dd14d69

File tree

6 files changed

+8
-51
lines changed

6 files changed

+8
-51
lines changed

eras/allegra/impl/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 1.8.0.0
44

5+
* Remove `TriesToForgeADA`
6+
* Change the type of `actualSize` and `PParameterMaxValue` fields in `OutputTooBigUTxO` to `Int`
57
* Added `COMPLETE` pragma for `TxCert AllegraEra`
68
* Added `COMPLETE` pragma for `NativeScript AllegraEra`
79
* Move to `testlib` `DecCBOR` instances for: `TxBody AllegraEra`, `AllegraTxAuxDataRaw`, `AllegraTxAuxData`, `TimelockRaw`, `Timelock`

eras/allegra/impl/src/Cardano/Ledger/Allegra/Rules/Utxo.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ data AllegraUtxoPredFailure era
8787
| UpdateFailure (EraRuleFailure "PPUP" era) -- Subtransition Failures
8888
| OutputBootAddrAttrsTooBig
8989
[TxOut era] -- list of supplied bad transaction outputs
90-
| -- Kept for backwards compatibility: no longer used because the `MultiAsset` type of mint doesn't allow for this possibility
91-
TriesToForgeADA -- TODO: remove
9290
| OutputTooBigUTxO
9391
[TxOut era] -- list of supplied bad transaction outputs
9492
deriving (Generic)
@@ -361,7 +359,6 @@ instance
361359
WrongNetwork right wrongs -> Sum WrongNetwork 8 !> To right !> To wrongs
362360
WrongNetworkWithdrawal right wrongs -> Sum WrongNetworkWithdrawal 9 !> To right !> To wrongs
363361
OutputBootAddrAttrsTooBig outs -> Sum OutputBootAddrAttrsTooBig 10 !> To outs
364-
TriesToForgeADA -> Sum TriesToForgeADA 11
365362
OutputTooBigUTxO outs -> Sum OutputTooBigUTxO 12 !> To outs
366363

367364
instance
@@ -382,7 +379,6 @@ instance
382379
8 -> SumD WrongNetwork <! From <! From
383380
9 -> SumD WrongNetworkWithdrawal <! From <! From
384381
10 -> SumD OutputBootAddrAttrsTooBig <! From
385-
11 -> SumD TriesToForgeADA
386382
12 -> SumD OutputTooBigUTxO <! From
387383
k -> Invalid k
388384

eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxo.hs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,9 @@ data AlonzoUtxoPredFailure era
148148
| -- | list of supplied bad transaction outputs
149149
OutputBootAddrAttrsTooBig
150150
[TxOut era]
151-
| -- Kept for backwards compatibility: no longer used because the `MultiAsset` type of mint doesn't allow for this possibility
152-
TriesToForgeADA
153151
| -- | list of supplied bad transaction output triples (actualSize,PParameterMaxValue,TxOut)
154152
OutputTooBigUTxO
155-
[(Integer, Integer, TxOut era)]
153+
[(Int, Int, TxOut era)]
156154
| InsufficientCollateral
157155
-- | balance computed
158156
DeltaCoin
@@ -645,8 +643,6 @@ encFail (WrongNetworkWithdrawal right wrongs) =
645643
Sum (WrongNetworkWithdrawal @era) 9 !> To right !> To wrongs
646644
encFail (OutputBootAddrAttrsTooBig outs) =
647645
Sum (OutputBootAddrAttrsTooBig @era) 10 !> To outs
648-
encFail TriesToForgeADA =
649-
Sum TriesToForgeADA 11
650646
encFail (OutputTooBigUTxO outs) =
651647
Sum (OutputTooBigUTxO @era) 12 !> To outs
652648
encFail (InsufficientCollateral a b) =
@@ -685,11 +681,7 @@ decFail 7 = SumD UtxosFailure <! From
685681
decFail 8 = SumD WrongNetwork <! From <! From
686682
decFail 9 = SumD WrongNetworkWithdrawal <! From <! From
687683
decFail 10 = SumD OutputBootAddrAttrsTooBig <! From
688-
decFail 11 = SumD TriesToForgeADA
689-
decFail 12 =
690-
let fromRestricted :: (Int, Int, TxOut era) -> (Integer, Integer, TxOut era)
691-
fromRestricted (sz, mv, txOut) = (toInteger sz, toInteger mv, txOut)
692-
in SumD OutputTooBigUTxO <! D (map fromRestricted <$> decCBOR)
684+
decFail 12 = SumD OutputTooBigUTxO <! From
693685
decFail 13 = SumD InsufficientCollateral <! From <! From
694686
decFail 14 = SumD ScriptsNotPaidUTxO <! D (UTxO <$> decCBOR)
695687
decFail 15 = SumD ExUnitsTooBigUTxO <! From
@@ -732,6 +724,5 @@ allegraToAlonzoUtxoPredFailure = \case
732724
Allegra.WrongNetworkWithdrawal x y -> WrongNetworkWithdrawal x y
733725
Allegra.OutputTooSmallUTxO x -> OutputTooSmallUTxO x
734726
Allegra.UpdateFailure x -> UtxosFailure (injectFailure @"UTXOS" @t x)
735-
Allegra.OutputBootAddrAttrsTooBig xs -> OutputTooBigUTxO (map (0,0,) xs)
736-
Allegra.TriesToForgeADA -> TriesToForgeADA
727+
Allegra.OutputBootAddrAttrsTooBig xs -> OutputBootAddrAttrsTooBig xs
737728
Allegra.OutputTooBigUTxO xs -> OutputTooBigUTxO (map (0,0,) xs)

eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Utxo.hs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -370,18 +370,7 @@ alonzoToConwayUtxoPredFailure = \case
370370
Alonzo.OutputTooSmallUTxO x -> OutputTooSmallUTxO x
371371
Alonzo.UtxosFailure x -> UtxosFailure x
372372
Alonzo.OutputBootAddrAttrsTooBig xs -> OutputBootAddrAttrsTooBig xs
373-
Alonzo.TriesToForgeADA ->
374-
error
375-
"Impossible case, soon to be removed. See: https://github.com/IntersectMBO/cardano-ledger/issues/4085"
376-
Alonzo.OutputTooBigUTxO xs ->
377-
let
378-
-- TODO: Remove this once the other eras will make the switch from Integer to Int
379-
-- as per #4015.
380-
-- https://github.com/IntersectMBO/cardano-ledger/issues/4085
381-
toRestricted :: (Integer, Integer, TxOut era) -> (Int, Int, TxOut era)
382-
toRestricted (sz, mv, out) = (fromIntegral sz, fromIntegral mv, out)
383-
in
384-
OutputTooBigUTxO $ map toRestricted xs
373+
Alonzo.OutputTooBigUTxO xs -> OutputTooBigUTxO xs
385374
Alonzo.InsufficientCollateral c1 c2 -> InsufficientCollateral c1 c2
386375
Alonzo.ScriptsNotPaidUTxO u -> ScriptsNotPaidUTxO u
387376
Alonzo.ExUnitsTooBigUTxO m -> ExUnitsTooBigUTxO m
@@ -408,7 +397,4 @@ allegraToConwayUtxoPredFailure = \case
408397
Allegra.OutputTooSmallUTxO x -> OutputTooSmallUTxO x
409398
Allegra.UpdateFailure x -> absurdEraRule @"PPUP" @era x
410399
Allegra.OutputBootAddrAttrsTooBig xs -> OutputBootAddrAttrsTooBig xs
411-
Allegra.TriesToForgeADA ->
412-
error
413-
"Impossible case, soon to be removed. See: https://github.com/IntersectMBO/cardano-ledger/issues/4085"
414400
Allegra.OutputTooBigUTxO xs -> OutputTooBigUTxO (map (0,0,) xs)

eras/shelley/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.17.0.0
44

5+
* Remove `withCborRoundTripFailures`
56
* Refactor pool deposits to use `StakePoolState`. #5234
67
* Update `Pool` rule to store deposits in individual `StakePoolState` records
78
* Add and export `prUTxOStateL`, `prChainAccountStateL`, and `prCertStateL` lenses for `ShelleyPoolreapState`

eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley/ImpTest.hs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ module Test.Cardano.Ledger.Shelley.ImpTest (
133133
withNoFixup,
134134
withPostFixup,
135135
withPreFixup,
136-
withCborRoundTripFailures,
137136
impNESL,
138137
impGlobalsL,
139138
impLastTickG,
@@ -260,7 +259,6 @@ import Numeric.Natural (Natural)
260259
import Prettyprinter (Doc)
261260
import Prettyprinter.Render.Terminal (AnsiStyle)
262261
import qualified System.Random.Stateful as R
263-
import Test.Cardano.Ledger.Binary.RoundTrip (roundTripCborRangeFailureExpectation)
264262
import Test.Cardano.Ledger.Core.Arbitrary ()
265263
import Test.Cardano.Ledger.Core.Binary.RoundTrip (roundTripEraExpectation)
266264
import Test.Cardano.Ledger.Core.KeyPair (ByronKeyPair (..), mkStakeRef, mkWitnessesVKey)
@@ -290,7 +288,6 @@ instance ShelleyEraImp era => ImpSpec (LedgerSpec era) where
290288
{ impInitEnv =
291289
ImpTestEnv
292290
{ iteFixup = fixupTx
293-
, iteCborRoundTripFailures = True
294291
, itePostSubmitTxHook = \_ _ _ -> pure ()
295292
}
296293
, impInitState = initState
@@ -766,8 +763,6 @@ data ImpTestEnv era = ImpTestEnv
766763
(NonEmpty (PredicateFailure (EraRule "LEDGER" era)))
767764
(State (EraRule "LEDGER" era), [Event (EraRule "LEDGER" era)]) ->
768765
ImpM t ()
769-
, iteCborRoundTripFailures :: Bool
770-
-- ^ Expect failures in CBOR round trip serialization tests for predicate failures
771766
}
772767

773768
iteFixupL :: Lens' (ImpTestEnv era) (Tx era -> ImpTestM era (Tx era))
@@ -787,9 +782,6 @@ itePostSubmitTxHookL ::
787782
)
788783
itePostSubmitTxHookL = lens itePostSubmitTxHook (\x y -> x {itePostSubmitTxHook = y})
789784

790-
iteCborRoundTripFailuresL :: Lens' (ImpTestEnv era) Bool
791-
iteCborRoundTripFailuresL = lens iteCborRoundTripFailures (\x y -> x {iteCborRoundTripFailures = y})
792-
793785
instance MonadWriter [SomeSTSEvent era] (ImpTestM era) where
794786
writer (x, evs) = (impEventsL %= (<> evs)) $> x
795787
listen act = do
@@ -1088,7 +1080,6 @@ trySubmitTx tx = do
10881080
lEnv <- impLedgerEnv st
10891081
ImpTestState {impRootTxIn} <- get
10901082
res <- tryRunImpRule @"LEDGER" lEnv (st ^. nesEsL . esLStateL) txFixed
1091-
roundTripCheck <- asks iteCborRoundTripFailures
10921083
globals <- use impGlobalsL
10931084
let trc = TRC (lEnv, st ^. nesEsL . esLStateL, txFixed)
10941085

@@ -1098,14 +1089,7 @@ trySubmitTx tx = do
10981089
case res of
10991090
Left predFailures -> do
11001091
-- Verify that produced predicate failures are ready for the node-to-client protocol
1101-
if roundTripCheck
1102-
then liftIO $ forM_ predFailures $ roundTripEraExpectation @era
1103-
else
1104-
liftIO $
1105-
roundTripCborRangeFailureExpectation
1106-
(eraProtVerLow @era)
1107-
(eraProtVerHigh @era)
1108-
predFailures
1092+
liftIO $ forM_ predFailures $ roundTripEraExpectation @era
11091093
pure $ Left (predFailures, txFixed)
11101094
Right (st', events) -> do
11111095
let txId = TxId . hashAnnotated $ txFixed ^. bodyTxL
@@ -1580,9 +1564,6 @@ registerAndRetirePoolToMakeReward stakingCred = do
15801564
& bodyTxL . certsTxBodyL .~ SSeq.singleton (RetirePoolTxCert poolId poolExpiry)
15811565
passNEpochs $ fromIntegral poolLifetime
15821566

1583-
withCborRoundTripFailures :: ImpTestM era a -> ImpTestM era a
1584-
withCborRoundTripFailures = local $ iteCborRoundTripFailuresL .~ False
1585-
15861567
-- | Compose given function with the configured fixup
15871568
withCustomFixup ::
15881569
((Tx era -> ImpTestM era (Tx era)) -> Tx era -> ImpTestM era (Tx era)) ->

0 commit comments

Comments
 (0)