Skip to content

Fix for state querying in tx validation query

bca18fd
Select commit
Loading
Failed to load commit list.
Draft

Implement ValidateTx query for LocalStateQuery protocol #2052

Fix for state querying in tx validation query
bca18fd
Select commit
Loading
Failed to load commit list.
IOG Hydra / ci/hydra-build:x86_64-linux.native.formattingLinting.fourmolu failed May 27, 2026 in 10s

Build failed

1 failed steps

Details

Failed Steps

Step 1

Derivation

/nix/store/w0qz7jxhvysb24fy5clas4m4fd5k65rb-check-fourmolu-exe-fourmolu.drv

Log

unpacking source archive /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source
source root is 73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source
The custom options for formatting this repo are:
fourmolu 0.18.0.0
using ghc-lib-parser 9.12.3.20251228
> indentation: 2
> column-limit: 100
> import-export-style: leading
> haddock-style: single-line
> single-constraint-parens: never
> single-deriving-parens: never
> import-grouping: single

Formatting haskell files...
Loaded config from: fourmolu.yaml
diff -ru /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/QueryHF.hs ./ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/QueryHF.hs
--- /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/QueryHF.hs      1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/ouroboros-consensus-cardano/Ouroboros/Consensus/Cardano/QueryHF.hs        2026-05-27 11:10:20.231151912 +0000
@@ -106,7 +106,9 @@
             (ejectHardForkTxOut idx)
             (coerce . ejectCanonicalTxIn idx)
             (getPerEraShelleyLedgerState idx forker)
-            cfg q forker
+            cfg
+            q
+            forker
       )
   answerBlockQueryHFTraverse =
     answerCardanoQueryHF
@@ -151,8 +153,8 @@
 
 projectNS :: Index xs x -> NS f xs -> Maybe (f x)
 projectNS idx ns = go (getIndex idx) ns
-  where
-    go :: NS ((:~:) x) ys -> NS f ys -> Maybe (f x)
-    go (Z Refl) (Z fx) = Just fx
-    go (S i)    (S s)  = go i s
-    go _        _      = Nothing
+ where
+  go :: NS ((:~:) x) ys -> NS f ys -> Maybe (f x)
+  go (Z Refl) (Z fx) = Just fx
+  go (S i) (S s) = go i s
+  go _ _ = Nothing
diff -ru /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs ./ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs
--- /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs     1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs       2026-05-27 11:10:21.369140937 +0000
@@ -60,6 +60,7 @@
 import Codec.CBOR.Encoding (Encoding)
 import qualified Codec.CBOR.Encoding as CBOR
 import Codec.Serialise (decode, encode)
+import Control.Monad.Except (runExcept)
 import Data.Bifunctor (second)
 import Data.Coerce
 import Data.Map.Strict (Map)
@@ -79,19 +80,17 @@
 import Ouroboros.Consensus.Ledger.Basics
 import Ouroboros.Consensus.Ledger.Extended
 import Ouroboros.Consensus.Ledger.Query
+import Ouroboros.Consensus.Ledger.SupportsMempool (WhetherToIntervene (..))
 import Ouroboros.Consensus.Ledger.SupportsPeerSelection
 import Ouroboros.Consensus.Ledger.SupportsProtocol
 import Ouroboros.Consensus.Protocol.Abstract (ChainDepState)
 import Ouroboros.Consensus.Protocol.Praos.Common
-import Control.Monad.Except (runExcept)
-import Ouroboros.Consensus.Ledger.SupportsMempool (WhetherToIntervene (..))
-import qualified Ouroboros.Consensus.Shelley.Eras as SE
 import Ouroboros.Consensus.Shelley.Eras (applyShelleyBasedTx)
+import qualified Ouroboros.Consensus.Shelley.Eras as SE
 import Ouroboros.Consensus.Shelley.Ledger.Block
 import Ouroboros.Consensus.Shelley.Ledger.Config
-import Ouroboros.Consensus.Shelley.Ledger.Mempool (GenTx (ShelleyTx))
-import Ouroboros.Consensus.Util.IOLike (MonadSTM (atomically))
 import Ouroboros.Consensus.Shelley.Ledger.Ledger
+import Ouroboros.Consensus.Shelley.Ledger.Mempool (GenTx (ShelleyTx))
 import Ouroboros.Consensus.Shelley.Ledger.NetworkProtocolVersion
   ( ShelleyNodeToClientVersion (..)
   , ledgerPeerSnapshotSupportsSRV
@@ -104,6 +103,7 @@
 import Ouroboros.Consensus.Storage.LedgerDB
 import qualified Ouroboros.Consensus.Storage.LedgerDB as LedgerDB
 import Ouroboros.Consensus.Util (ShowProxy (..), coerceSet)
+import Ouroboros.Consensus.Util.IOLike (MonadSTM (atomically))
 import Ouroboros.Consensus.Util.IndexedMemPack
 import Ouroboros.Network.Block
   ( Point (..)
@@ -556,9 +556,14 @@
     st = shelleyLedgerState lst
 
   answerBlockQueryLookup cfg q forker =
-    answerShelleyLookupQueries id id coerce
+    answerShelleyLookupQueries
+      id
+      id
+      coerce
       (ledgerState <$> atomically (LedgerDB.roforkerGetLedgerState forker))
-      cfg q forker
+      cfg
+      q
+      forker
 
   answerBlockQueryTraverse = answerShelleyTraversingQueries id coerce shelleyQFTraverseTablesPredicate
 
diff -ru /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs ./ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs
--- /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs       1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/ShelleyHFC.hs 2026-05-27 11:10:20.828146155 +0000
@@ -472,10 +472,21 @@
     IZ -> \cfg q forker ->
       let getShelleyLedgerSt = do
             ext <- atomically (roforkerGetLedgerState forker)
-            pure $ unFlip $ currentState $ Telescope.fromTZ $
-              getHardForkState $ hardForkLedgerStatePerEra $ ledgerState ext
-       in answerShelleyLookupQueries (injectLedgerTables IZ) id (coerce . ejectCanonicalTxIn IZ)
-            getShelleyLedgerSt cfg q forker
+            pure $
+              unFlip $
+                currentState $
+                  Telescope.fromTZ $
+                    getHardForkState $
+                      hardForkLedgerStatePerEra $
+                        ledgerState ext
+       in answerShelleyLookupQueries
+            (injectLedgerTables IZ)
+            id
+            (coerce . ejectCanonicalTxIn IZ)
+            getShelleyLedgerSt
+            cfg
+            q
+            forker
     IS idx -> case idx of {}
 
   answerBlockQueryHFTraverse = \case
diff -ru /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs ./ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs
--- /nix/store/axmjyly3jlw8ypfyl0nxf90psg2yrs6m-73r6g6888fxzlyw2qyrfifxhx6bwf0nb-source/ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs   1970-01-01 00:00:01.000000000 +0000
+++ ./ouroboros-consensus-cardano/src/unstable-cardano-testlib/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs     2026-05-27 11:10:21.284141757 +0000
@@ -64,10 +64,10 @@
 import Data.SOP.Functors (Flip (..))
 import qualified Data.SOP.InPairs as InPairs
 import Data.SOP.Index (Index (..), getIndex, hcimap)
-import Data.Type.Equality ((:~:) (..))
 import Data.SOP.Strict
 import qualified Data.SOP.Tails as Tails
 import qualified Data.SOP.Telescope as Telescope
+import Data.Type.Equality ((:~:) (..))
 import Data.Void (Void)
 import Lens.Micro ((^.))
 import NoThunks.Class (NoThunks)
@@ -369,7 +369,9 @@
             (ejectHardForkTxOutDefault idx)
             (coerce . ejectCanonicalTxIn idx)
             (getPerEraShelleyLedgerState idx forker)
-            cfg q forker
+            cfg
+            q
+            forker
       )
 
   answerBlockQueryHFTraverse =
@@ -404,11 +406,11 @@
 
 projectNS :: Index xs x -> NS f xs -> Maybe (f x)
 projectNS idx = go (getIndex idx)
-  where
-    go :: NS ((:~:) x) ys -> NS f ys -> Maybe (f x)
-    go (Z Refl) (Z fx) = Just fx
-    go (S i)    (S s)  = go i s
-    go _        _      = Nothing
+ where
+  go :: NS ((:~:) x) ys -> NS f ys -> Maybe (f x)
+  go (Z Refl) (Z fx) = Just fx
+  go (S i) (S s) = go i s
+  go _ _ = Nothing
 
 {-------------------------------------------------------------------------------
   Protocol info
*** fourmolu-exe-fourmolu-0.18.0.0 found changes that need addressed first