@@ -197,6 +197,7 @@ import Cardano.Ledger.Keys (
197197 )
198198import Cardano.Ledger.Shelley (ShelleyEra )
199199import Cardano.Ledger.Shelley.API.ByronTranslation (translateToShelleyLedgerStateFromUtxo )
200+ import Cardano.Ledger.Shelley.API.Validation (BlockTransitionError (.. ), applyBlockEither )
200201import Cardano.Ledger.Shelley.AdaPots (sumAdaPots , totalAdaPotsES )
201202import Cardano.Ledger.Shelley.Core
202203import Cardano.Ledger.Shelley.Genesis (
@@ -213,7 +214,6 @@ import Cardano.Ledger.Shelley.LedgerState (
213214 esLStateL ,
214215 lsCertStateL ,
215216 lsUTxOStateL ,
216- nesBcurL ,
217217 nesELL ,
218218 nesEsL ,
219219 prevPParamsEpochStateL ,
@@ -1428,24 +1428,21 @@ tryTxsInBlock act = do
14281428 pure $ Block {blockHeader, blockBody}
14291429
14301430 res <- do
1431+ globals <- use impGlobalsL
14311432 let nes = startingState ^. impNESL
1432- ls = nes ^. nesEsL . esLStateL
1433- pp = nes ^. nesEsL . curPParamsEpochStateL @ era
1434- ca = nes ^. chainAccountStateL
1435- bm = nes ^. nesBcurL
1436- tryRunImpRule @ " BBODY" (BbodyEnv pp ca) (BbodyState ls (BlocksMade bm)) block
1433+ pure $ applyBlockEither EPReturn ValidateAll globals nes block
14371434
14381435 case res of
1439- Left predFailures -> do
1436+ Left ( BlockTransitionError predFailures) -> do
14401437 put startingState
14411438 -- Verify that produced predicate failures are ready for the node-to-client protocol
14421439 liftIO $ forM_ predFailures $ roundTripEraExpectation @ era
14431440 pure $ Left (predFailures, block)
1444- Right (BbodyState bbodyLedgerState _ , events) -> do
1441+ Right (blockNes , events) -> do
14451442 let stsEvents = SomeSTSEvent @ era @ " BBODY" <$> events
1446- bbodyEvents = startingState ^. impEventsL <> Seq. fromList stsEvents
1447- impNESL . nesEsL . esLStateL .= bbodyLedgerState
1448- impEventsL .= bbodyEvents
1443+ blockEvents = startingState ^. impEventsL <> Seq. fromList stsEvents
1444+ impNESL .= blockNes
1445+ impEventsL .= blockEvents
14491446
14501447 pure $ Right block
14511448
0 commit comments